org.codehaus.jackson.map.deser.impl.StringCollectionDeserializer Maven / Gradle / Ivy
Go to download
Data Mapper package is a high-performance data binding package
built on Jackson JSON processor
package org.codehaus.jackson.map.deser.impl;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.util.Collection;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.JsonToken;
import org.codehaus.jackson.map.DeserializationConfig;
import org.codehaus.jackson.map.DeserializationContext;
import org.codehaus.jackson.map.JsonDeserializer;
import org.codehaus.jackson.map.TypeDeserializer;
import org.codehaus.jackson.map.annotate.JacksonStdImpl;
import org.codehaus.jackson.map.deser.ContainerDeserializer;
import org.codehaus.jackson.type.JavaType;
@JacksonStdImpl
public final class StringCollectionDeserializer
extends ContainerDeserializer>
{
// // Configuration
protected final JavaType _collectionType;
/**
* Value deserializer; needed even if it is the standard String
* deserializer
*/
protected final JsonDeserializer _valueDeserializer;
/**
* Flag that indicates whether value deserializer is the standard
* Jackson-provided one; if it is, we can use more efficient
* handling.
*/
protected final boolean _isDefaultDeserializer;
/**
* We will use the default constructor of the collection class for
* instantiating result.
*/
final Constructor> _defaultCtor;
@SuppressWarnings("unchecked")
public StringCollectionDeserializer(JavaType collectionType, JsonDeserializer> valueDeser,
Constructor> ctor)
{
super(collectionType.getRawClass());
_collectionType = collectionType;
_valueDeserializer = (JsonDeserializer) valueDeser;
_defaultCtor = (Constructor>) ctor;
_isDefaultDeserializer = isDefaultSerializer(valueDeser);
}
/*
/**********************************************************
/* ContainerDeserializer API
/**********************************************************
*/
@Override
public JavaType getContentType() {
return _collectionType.getContentType();
}
@SuppressWarnings("unchecked")
@Override
public JsonDeserializer