本文整理汇总了Java中com.fasterxml.jackson.databind.KeyDeserializer类的典型用法代码示例。如果您正苦于以下问题:Java KeyDeserializer类的具体用法?Java KeyDeserializer怎么用?Java KeyDeserializer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
KeyDeserializer类属于com.fasterxml.jackson.databind包,在下文中一共展示了KeyDeserializer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createMapLikeDeserializer
import com.fasterxml.jackson.databind.KeyDeserializer; //导入依赖的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;
}
示例2: findStringBasedKeyDeserializer
import com.fasterxml.jackson.databind.KeyDeserializer; //导入依赖的package包/类
public static KeyDeserializer findStringBasedKeyDeserializer(DeserializationConfig paramDeserializationConfig, JavaType paramJavaType)
{
BeanDescription localBeanDescription = paramDeserializationConfig.introspect(paramJavaType);
Constructor localConstructor = localBeanDescription.findSingleArgConstructor(new Class[] { String.class });
if (localConstructor != null)
{
if (paramDeserializationConfig.canOverrideAccessModifiers())
ClassUtil.checkAndFixAccess(localConstructor);
return new StdKeyDeserializer.StringCtorKeyDeserializer(localConstructor);
}
Method localMethod = localBeanDescription.findFactoryMethod(new Class[] { String.class });
if (localMethod != null)
{
if (paramDeserializationConfig.canOverrideAccessModifiers())
ClassUtil.checkAndFixAccess(localMethod);
return new StdKeyDeserializer.StringFactoryKeyDeserializer(localMethod);
}
return null;
}
示例3: createContextual
import com.fasterxml.jackson.databind.KeyDeserializer; //导入依赖的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);
}
示例4: _deserializeEntries
import com.fasterxml.jackson.databind.KeyDeserializer; //导入依赖的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();
}
示例5: findMapDeserializer
import com.fasterxml.jackson.databind.KeyDeserializer; //导入依赖的package包/类
@Override
public JsonDeserializer<?> findMapDeserializer(MapType type, DeserializationConfig config,
BeanDescription beanDesc, KeyDeserializer keyDeserializer,
TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer) {
return forJavaType(type);
}
示例6: findMapDeserializer
import com.fasterxml.jackson.databind.KeyDeserializer; //导入依赖的package包/类
@Override
public JsonDeserializer<?> findMapDeserializer(MapType type,
DeserializationConfig config, BeanDescription beanDesc,
KeyDeserializer keyDeserializer,
TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer)
throws JsonMappingException {
return null;
}
示例7: findMapLikeDeserializer
import com.fasterxml.jackson.databind.KeyDeserializer; //导入依赖的package包/类
@Override
public JsonDeserializer<?> findMapLikeDeserializer(MapLikeType type,
DeserializationConfig config, BeanDescription beanDesc,
KeyDeserializer keyDeserializer, TypeDeserializer elementTypeDeserializer,
JsonDeserializer<?> elementDeserializer)
throws JsonMappingException {
return null;
}
示例8: keyDeserializerInstance
import com.fasterxml.jackson.databind.KeyDeserializer; //导入依赖的package包/类
@Override
public KeyDeserializer keyDeserializerInstance(
DeserializationConfig deserializationConfig,
Annotated annotated,
Class<?> keyDeserializerClass) {
return null;
}
示例9: findKeyDeserializer
import com.fasterxml.jackson.databind.KeyDeserializer; //导入依赖的package包/类
@Override
public KeyDeserializer findKeyDeserializer(JavaType type, DeserializationConfig config, BeanDescription beanDesc) throws JsonMappingException {
final Class<?> candidateTT = type.getRawClass();
if (MetaTinyTypes.isTinyType(candidateTT)) {
return new TinyTypesKeyDeserializer(candidateTT);
}
return null;
}
示例10: yieldsKeyDeserializerForAnyKindOfTinyType
import com.fasterxml.jackson.databind.KeyDeserializer; //导入依赖的package包/类
@Theory
public void yieldsKeyDeserializerForAnyKindOfTinyType(Class<?> tinyType) throws JsonMappingException {
final JavaType tinyTypeType = TypeFactory.defaultInstance().uncheckedSimpleType(tinyType);
final KeyDeserializer got = new TinyTypesKeyDeserializers().findKeyDeserializer(tinyTypeType, null, null);
Assert.assertNotNull(got);
}
示例11: addDeserializer
import com.fasterxml.jackson.databind.KeyDeserializer; //导入依赖的package包/类
public SimpleKeyDeserializers addDeserializer(Class<?> paramClass, KeyDeserializer paramKeyDeserializer)
{
if (this._classMappings == null)
this._classMappings = new HashMap();
this._classMappings.put(new ClassKey(paramClass), paramKeyDeserializer);
return this;
}
示例12: addKeyDeserializer
import com.fasterxml.jackson.databind.KeyDeserializer; //导入依赖的package包/类
public SimpleModule addKeyDeserializer(Class<?> paramClass, KeyDeserializer paramKeyDeserializer)
{
if (this._keyDeserializers == null)
this._keyDeserializers = new SimpleKeyDeserializers();
this._keyDeserializers.addDeserializer(paramClass, paramKeyDeserializer);
return this;
}
示例13: findKeyDeserializer
import com.fasterxml.jackson.databind.KeyDeserializer; //导入依赖的package包/类
public Class<? extends KeyDeserializer> findKeyDeserializer(Annotated paramAnnotated)
{
JsonDeserialize localJsonDeserialize = (JsonDeserialize)paramAnnotated.getAnnotation(JsonDeserialize.class);
if (localJsonDeserialize != null)
{
Class localClass = localJsonDeserialize.keyUsing();
if (localClass != KeyDeserializer.None.class)
return localClass;
}
return null;
}
示例14: _createEnumKeyDeserializer
import com.fasterxml.jackson.databind.KeyDeserializer; //导入依赖的package包/类
private KeyDeserializer _createEnumKeyDeserializer(DeserializationContext paramDeserializationContext, JavaType paramJavaType)
{
DeserializationConfig localDeserializationConfig = paramDeserializationContext.getConfig();
BeanDescription localBeanDescription = localDeserializationConfig.introspect(paramJavaType);
JsonDeserializer localJsonDeserializer = findDeserializerFromAnnotation(paramDeserializationContext, localBeanDescription.getClassInfo());
if (localJsonDeserializer != null)
return StdKeyDeserializers.constructDelegatingKeyDeserializer(localDeserializationConfig, paramJavaType, localJsonDeserializer);
Class localClass = paramJavaType.getRawClass();
if (_findCustomEnumDeserializer(localClass, localDeserializationConfig, localBeanDescription) != null)
return StdKeyDeserializers.constructDelegatingKeyDeserializer(localDeserializationConfig, paramJavaType, localJsonDeserializer);
EnumResolver localEnumResolver = constructEnumResolver(localClass, localDeserializationConfig, localBeanDescription.findJsonValueMethod());
Iterator localIterator = localBeanDescription.getFactoryMethods().iterator();
while (localIterator.hasNext())
{
AnnotatedMethod localAnnotatedMethod = (AnnotatedMethod)localIterator.next();
if (localDeserializationConfig.getAnnotationIntrospector().hasCreatorAnnotation(localAnnotatedMethod))
{
if ((localAnnotatedMethod.getParameterCount() == 1) && (localAnnotatedMethod.getRawReturnType().isAssignableFrom(localClass)))
{
if (localAnnotatedMethod.getGenericParameterType(0) != String.class)
throw new IllegalArgumentException("Parameter #0 type for factory method (" + localAnnotatedMethod + ") not suitable, must be java.lang.String");
if (localDeserializationConfig.canOverrideAccessModifiers())
ClassUtil.checkAndFixAccess(localAnnotatedMethod.getMember());
return StdKeyDeserializers.constructEnumKeyDeserializer(localEnumResolver, localAnnotatedMethod);
}
throw new IllegalArgumentException("Unsuitable method (" + localAnnotatedMethod + ") decorated with @JsonCreator (for Enum type " + localClass.getName() + ")");
}
}
return StdKeyDeserializers.constructEnumKeyDeserializer(localEnumResolver);
}
示例15: _findCustomMapDeserializer
import com.fasterxml.jackson.databind.KeyDeserializer; //导入依赖的package包/类
protected JsonDeserializer<?> _findCustomMapDeserializer(MapType paramMapType, DeserializationConfig paramDeserializationConfig, BeanDescription paramBeanDescription, KeyDeserializer paramKeyDeserializer, TypeDeserializer paramTypeDeserializer, JsonDeserializer<?> paramJsonDeserializer)
{
Iterator localIterator = this._factoryConfig.deserializers().iterator();
while (localIterator.hasNext())
{
JsonDeserializer localJsonDeserializer = ((Deserializers)localIterator.next()).findMapDeserializer(paramMapType, paramDeserializationConfig, paramBeanDescription, paramKeyDeserializer, paramTypeDeserializer, paramJsonDeserializer);
if (localJsonDeserializer != null)
return localJsonDeserializer;
}
return null;
}