本文整理汇总了Java中com.fasterxml.jackson.databind.jsontype.TypeDeserializer类的典型用法代码示例。如果您正苦于以下问题:Java TypeDeserializer类的具体用法?Java TypeDeserializer怎么用?Java TypeDeserializer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TypeDeserializer类属于com.fasterxml.jackson.databind.jsontype包,在下文中一共展示了TypeDeserializer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createContextual
import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; //导入依赖的package包/类
/**
* Method called to finalize setup of this deserializer,
* after deserializer itself has been registered. This
* is needed to handle recursive and transitive dependencies.
*/
@Override
public JsonDeserializer<?> createContextual(DeserializationContext ctxt,
BeanProperty property) throws JsonMappingException {
JsonDeserializer<?> deser = _valueDeserializer;
TypeDeserializer typeDeser = _typeDeserializerForValue;
if (deser == null) {
deser = ctxt.findContextualValueDeserializer(_containerType.getContentType(), property);
}
if (typeDeser != null) {
typeDeser = typeDeser.forProperty(property);
}
if (deser == _valueDeserializer && typeDeser == _typeDeserializerForValue) {
return this;
}
return withResolved(typeDeser, deser);
}
示例2: _deserializeFromSingleValue
import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; //导入依赖的package包/类
@Override
protected T _deserializeFromSingleValue(JsonParser jp, DeserializationContext ctxt)
throws IOException, JsonProcessingException {
JsonDeserializer<?> valueDes = _valueDeserializer;
final TypeDeserializer typeDeser = _typeDeserializerForValue;
JsonToken t = jp.getCurrentToken();
Object value;
if (t == JsonToken.VALUE_NULL) {
value = null;
} else if (typeDeser == null) {
value = valueDes.deserialize(jp, ctxt);
} else {
value = valueDes.deserializeWithType(jp, ctxt, typeDeser);
}
@SuppressWarnings("unchecked")
T result = (T) Sequences.sequence(value);
return result;
}
示例3: findCollectionLikeDeserializer
import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; //导入依赖的package包/类
@Override
public JsonDeserializer<?> findCollectionLikeDeserializer(CollectionLikeType type,
DeserializationConfig config, BeanDescription beanDesc,
TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer)
throws JsonMappingException
{
Class<?> raw = type.getRawClass();
if (raw == CharSeq.class) {
return new CharSeqDeserializer(type);
}
if (Seq.class.isAssignableFrom(raw)) {
return new SeqDeserializer(type, settings.deserializeNullAsEmptyCollection());
}
if (Set.class.isAssignableFrom(raw)) {
return new SetDeserializer(type, settings.deserializeNullAsEmptyCollection());
}
if (PriorityQueue.class.isAssignableFrom(raw)) {
return new PriorityQueueDeserializer(type, settings.deserializeNullAsEmptyCollection());
}
return super.findCollectionLikeDeserializer(type, config, beanDesc, elementTypeDeserializer, elementDeserializer);
}
示例4: findMapLikeDeserializer
import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; //导入依赖的package包/类
@Override
public JsonDeserializer<?> findMapLikeDeserializer(MapLikeType type,
DeserializationConfig config, BeanDescription beanDesc,
KeyDeserializer keyDeserializer,
TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer)
throws JsonMappingException
{
Class<?> raw = type.getRawClass();
if (Map.class.isAssignableFrom(raw)) {
return new MapDeserializer(type);
}
if (Multimap.class.isAssignableFrom(raw)) {
return new MultimapDeserializer(type);
}
return super.findMapLikeDeserializer(type, config, beanDesc, keyDeserializer, elementTypeDeserializer, elementDeserializer);
}
示例5: buildTypeDeserializer
import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; //导入依赖的package包/类
public TypeDeserializer buildTypeDeserializer(DeserializationConfig paramDeserializationConfig, JavaType paramJavaType, Collection<NamedType> paramCollection)
{
if (this._idType == JsonTypeInfo.Id.NONE)
return null;
TypeIdResolver localTypeIdResolver = idResolver(paramDeserializationConfig, paramJavaType, paramCollection, false, true);
switch (1.$SwitchMap$com$fasterxml$jackson$annotation$JsonTypeInfo$As[this._includeAs.ordinal()])
{
default:
break;
case 1:
return new AsArrayTypeDeserializer(paramJavaType, localTypeIdResolver, this._typeProperty, this._typeIdVisible, this._defaultImpl);
case 2:
return new AsPropertyTypeDeserializer(paramJavaType, localTypeIdResolver, this._typeProperty, this._typeIdVisible, this._defaultImpl);
case 3:
return new AsWrapperTypeDeserializer(paramJavaType, localTypeIdResolver, this._typeProperty, this._typeIdVisible, this._defaultImpl);
case 4:
return new AsExternalTypeDeserializer(paramJavaType, localTypeIdResolver, this._typeProperty, this._typeIdVisible, this._defaultImpl);
}
throw new IllegalStateException("Do not know how to construct standard type serializer for inclusion type: " + this._includeAs);
}
示例6: _deserializeEntries
import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected T _deserializeEntries(JsonParser jp, DeserializationContext ctxt) throws IOException {
final KeyDeserializer keyDes = keyDeserializer;
final JsonDeserializer<?> valueDes = valueDeserializer;
final TypeDeserializer typeDeser = typeDeserializerForValue;
MapF<Object, Object> map = newInstance();
for (; jp.getCurrentToken() == JsonToken.FIELD_NAME; jp.nextToken()) {
String fieldName = jp.getCurrentName();
Object key = (keyDes == null) ? fieldName : keyDes.deserializeKey(fieldName, ctxt);
JsonToken t = jp.nextToken();
Object value;
if (t == JsonToken.VALUE_NULL) {
value = null;
} else if (typeDeser == null) {
value = valueDes.deserialize(jp, ctxt);
} else {
value = valueDes.deserializeWithType(jp, ctxt, typeDeser);
}
map.put(key, value);
}
return (T) map.unmodifiable();
}
示例7: createMapLikeDeserializer
import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; //导入依赖的package包/类
public JsonDeserializer<?> createMapLikeDeserializer(DeserializationContext paramDeserializationContext, MapLikeType paramMapLikeType, BeanDescription paramBeanDescription)
{
JavaType localJavaType1 = paramMapLikeType.getKeyType();
JavaType localJavaType2 = paramMapLikeType.getContentType();
DeserializationConfig localDeserializationConfig = paramDeserializationContext.getConfig();
JsonDeserializer localJsonDeserializer1 = (JsonDeserializer)localJavaType2.getValueHandler();
KeyDeserializer localKeyDeserializer = (KeyDeserializer)localJavaType1.getValueHandler();
TypeDeserializer localTypeDeserializer1 = (TypeDeserializer)localJavaType2.getTypeHandler();
TypeDeserializer localTypeDeserializer2 = localTypeDeserializer1;
if (localTypeDeserializer1 == null)
localTypeDeserializer2 = findTypeDeserializer(localDeserializationConfig, localJavaType2);
JsonDeserializer localJsonDeserializer2 = _findCustomMapLikeDeserializer(paramMapLikeType, localDeserializationConfig, paramBeanDescription, localKeyDeserializer, localTypeDeserializer2, localJsonDeserializer1);
JsonDeserializer localJsonDeserializer3 = localJsonDeserializer2;
if ((localJsonDeserializer2 != null) && (this._factoryConfig.hasDeserializerModifiers()))
{
Iterator localIterator = this._factoryConfig.deserializerModifiers().iterator();
while (localIterator.hasNext())
localJsonDeserializer3 = ((BeanDeserializerModifier)localIterator.next()).modifyMapLikeDeserializer(localDeserializationConfig, paramMapLikeType, paramBeanDescription, localJsonDeserializer3);
}
return localJsonDeserializer3;
}
示例8: findTypeDeserializer
import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; //导入依赖的package包/类
public TypeDeserializer findTypeDeserializer(DeserializationConfig paramDeserializationConfig, JavaType paramJavaType)
{
AnnotatedClass localAnnotatedClass = paramDeserializationConfig.introspectClassAnnotations(paramJavaType.getRawClass()).getClassInfo();
AnnotationIntrospector localAnnotationIntrospector = paramDeserializationConfig.getAnnotationIntrospector();
Object localObject = localAnnotationIntrospector.findTypeResolver(paramDeserializationConfig, localAnnotatedClass, paramJavaType);
Collection localCollection;
if (localObject == null)
{
TypeResolverBuilder localTypeResolverBuilder = paramDeserializationConfig.getDefaultTyper(paramJavaType);
localObject = localTypeResolverBuilder;
localCollection = null;
if (localTypeResolverBuilder == null)
return null;
}
else
{
localCollection = paramDeserializationConfig.getSubtypeResolver().collectAndResolveSubtypes(localAnnotatedClass, paramDeserializationConfig, localAnnotationIntrospector);
}
if ((((TypeResolverBuilder)localObject).getDefaultImpl() == null) && (paramJavaType.isAbstract()))
{
JavaType localJavaType = mapAbstractType(paramDeserializationConfig, paramJavaType);
if ((localJavaType != null) && (localJavaType.getRawClass() != paramJavaType.getRawClass()))
localObject = ((TypeResolverBuilder)localObject).defaultImpl(localJavaType.getRawClass());
}
return ((TypeResolverBuilder)localObject).buildTypeDeserializer(paramDeserializationConfig, paramJavaType, localCollection);
}
示例9: _deserializeSingle
import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected T _deserializeSingle(JsonParser jp, DeserializationContext ctxt) throws IOException {
JsonDeserializer<?> valueDes = valueDeserializer;
final TypeDeserializer typeDeser = typeDeserializerForValue;
CollectionF<Object> collection = newInstance();
Object value;
if (jp.getCurrentToken() == JsonToken.VALUE_NULL) {
value = valueDes.getNullValue();
} else if (typeDeser == null) {
value = valueDes.deserialize(jp, ctxt);
} else {
value = valueDes.deserializeWithType(jp, ctxt, typeDeser);
}
collection.add(value);
return (T) collection.unmodifiable();
}
示例10: createContextual
import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; //导入依赖的package包/类
public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException {
KeyDeserializer keyDeser = keyDeserializer;
JsonDeserializer<?> deser = valueDeserializer;
TypeDeserializer typeDeser = typeDeserializerForValue;
if ((keyDeser != null) && (deser != null) && (typeDeser == null)) {
return this;
}
if (keyDeser == null) {
keyDeser = ctxt.findKeyDeserializer(mapType.getKeyType(), property);
}
if (deser == null) {
deser = ctxt.findContextualValueDeserializer(mapType.getContentType(), property);
}
if (typeDeser != null) {
typeDeser = typeDeser.forProperty(property);
}
return withResolved(keyDeser, typeDeser, deser);
}
示例11: findCollectionDeserializer
import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; //导入依赖的package包/类
@Override
public JsonDeserializer<?> findCollectionDeserializer(CollectionType type, DeserializationConfig config, BeanDescription beanDesc,
TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) throws JsonMappingException
{
Class<?> raw = type.getRawClass();
if (CollectionF.class.isAssignableFrom(raw)) {
if (Option.class.isAssignableFrom(raw)) {
return new OptionDeserializer(type, elementTypeDeserializer, elementDeserializer);
}
if (ListF.class.isAssignableFrom(raw)) {
return new ListFDeserializer(type, elementTypeDeserializer, elementDeserializer);
}
if (SetF.class.isAssignableFrom(raw)) {
return new SetFDeserializer(type, elementTypeDeserializer, elementDeserializer);
}
return new ListFDeserializer(type, elementTypeDeserializer, elementDeserializer);
}
return null;
}
示例12: deserialize
import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; //导入依赖的package包/类
public Collection<Object> deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext, Collection<Object> paramCollection)
{
if (!paramJsonParser.isExpectedStartArrayToken())
return handleNonArray(paramJsonParser, paramDeserializationContext, paramCollection);
JsonDeserializer localJsonDeserializer = this._valueDeserializer;
TypeDeserializer localTypeDeserializer = this._valueTypeDeserializer;
while (true)
{
JsonToken localJsonToken = paramJsonParser.nextToken();
if (localJsonToken == JsonToken.END_ARRAY)
break;
Object localObject;
if (localJsonToken == JsonToken.VALUE_NULL)
localObject = null;
else if (localTypeDeserializer == null)
localObject = localJsonDeserializer.deserialize(paramJsonParser, paramDeserializationContext);
else
localObject = localJsonDeserializer.deserializeWithType(paramJsonParser, paramDeserializationContext, localTypeDeserializer);
paramCollection.add(localObject);
}
return paramCollection;
}
示例13: _deserializeContents
import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected T _deserializeContents(JsonParser jp, DeserializationContext ctxt) throws IOException {
JsonDeserializer<?> valueDes = valueDeserializer;
JsonToken t;
final TypeDeserializer typeDeser = typeDeserializerForValue;
CollectionF<Object> collection = newInstance();
while ((t = jp.nextToken()) != JsonToken.END_ARRAY) {
Object value;
if (t == JsonToken.VALUE_NULL) {
value = valueDes.getNullValue();
} else if (typeDeser == null) {
value = valueDes.deserialize(jp, ctxt);
} else {
value = valueDes.deserializeWithType(jp, ctxt, typeDeser);
}
collection.add(value);
}
return (T) collection.unmodifiable();
}
示例14: handleNonArray
import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; //导入依赖的package包/类
protected final Collection<Object> handleNonArray(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext, Collection<Object> paramCollection)
{
if (!paramDeserializationContext.isEnabled(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY))
throw paramDeserializationContext.mappingException(this._collectionType.getRawClass());
JsonDeserializer localJsonDeserializer = this._valueDeserializer;
TypeDeserializer localTypeDeserializer = this._valueTypeDeserializer;
Object localObject;
if (paramJsonParser.getCurrentToken() == JsonToken.VALUE_NULL)
localObject = null;
else if (localTypeDeserializer == null)
localObject = localJsonDeserializer.deserialize(paramJsonParser, paramDeserializationContext);
else
localObject = localJsonDeserializer.deserializeWithType(paramJsonParser, paramDeserializationContext, localTypeDeserializer);
paramCollection.add(localObject);
return paramCollection;
}
示例15: SettableBeanProperty
import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; //导入依赖的package包/类
public SettableBeanProperty(String paramString, JavaType paramJavaType, PropertyName paramPropertyName, TypeDeserializer paramTypeDeserializer, Annotations paramAnnotations, boolean paramBoolean)
{
if ((paramString == null) || (paramString.length() == 0))
this._propName = "";
else
this._propName = InternCache.instance.intern(paramString);
this._type = paramJavaType;
this._wrapperName = paramPropertyName;
this._isRequired = paramBoolean;
this._contextAnnotations = paramAnnotations;
this._viewMatcher = null;
this._nullProvider = null;
if (paramTypeDeserializer != null)
paramTypeDeserializer = paramTypeDeserializer.forProperty(this);
this._valueTypeDeserializer = paramTypeDeserializer;
this._valueDeserializer = MISSING_VALUE_DESERIALIZER;
}