package com.fasterxml.jackson.databind.deser.std;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.ArrayBlockingQueue;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.deser.NullValueProvider;
import com.fasterxml.jackson.databind.deser.ValueInstantiator;
import com.fasterxml.jackson.databind.jsontype.TypeDeserializer;
public class ArrayBlockingQueueDeserializer
extends CollectionDeserializer
{
private static final long serialVersionUID = 1;
public ArrayBlockingQueueDeserializer(JavaType containerType,
JsonDeserializer<Object> valueDeser, TypeDeserializer valueTypeDeser,
ValueInstantiator valueInstantiator)
{
super(containerType, valueDeser, valueTypeDeser, valueInstantiator);
}
protected ArrayBlockingQueueDeserializer(JavaType containerType,
JsonDeserializer<Object> valueDeser, TypeDeserializer valueTypeDeser,
ValueInstantiator valueInstantiator,
JsonDeserializer<Object> delegateDeser,
NullValueProvider nuller, Boolean unwrapSingle)
{
super(containerType, valueDeser, valueTypeDeser, valueInstantiator, delegateDeser,
nuller, unwrapSingle);
}
protected ArrayBlockingQueueDeserializer(ArrayBlockingQueueDeserializer src) {
super(src);
}
@Override
@SuppressWarnings("unchecked")
protected ArrayBlockingQueueDeserializer withResolved(JsonDeserializer<?> dd,
JsonDeserializer<?> vd, TypeDeserializer vtd,
NullValueProvider nuller, Boolean unwrapSingle)
{
return new ArrayBlockingQueueDeserializer(_containerType,
(JsonDeserializer<Object>) vd, vtd,
_valueInstantiator, (JsonDeserializer<Object>) dd,
nuller, unwrapSingle);
}
@Override
protected Collection<Object> createDefaultInstance(DeserializationContext ctxt)
throws IOException
{
return null;
}
@Override
protected Collection<Object> _deserializeFromArray(JsonParser p, DeserializationContext ctxt,
Collection<Object> result0)
throws IOException
{
if (result0 == null) {
result0 = new ArrayList<>();
}
result0 = super._deserializeFromArray(p, ctxt, result0);
if (result0.isEmpty()) {
return new ArrayBlockingQueue<>(1, false);
}
return new ArrayBlockingQueue<>(result0.size(), false, result0);
}
@Override
public Object deserializeWithType(JsonParser p, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException {
return typeDeserializer.deserializeTypedFromArray(p, ctxt);
}
}