protected JsonSerializer<?> _findInterfaceMapping(Class<?> paramClass, ClassKey paramClassKey) { for (Class localClass : paramClass.getInterfaces()) { paramClassKey.reset(localClass); JsonSerializer localJsonSerializer = (JsonSerializer)this._interfaceMappings.get(paramClassKey); if (localJsonSerializer != null); do { return localJsonSerializer; localJsonSerializer = _findInterfaceMapping(localClass, paramClassKey); } while (localJsonSerializer != null); } return null; }
public final void addMixInAnnotations(Class<?> paramClass1, Class<?> paramClass2) { if (this._mixInAnnotations == null) { this._mixInAnnotationsShared = false; this._mixInAnnotations = new HashMap(); } while (true) { this._mixInAnnotations.put(new ClassKey(paramClass1), paramClass2); return; if (!this._mixInAnnotationsShared) continue; this._mixInAnnotationsShared = false; this._mixInAnnotations = new HashMap(this._mixInAnnotations); } }
public final void setMixInAnnotations(Map<Class<?>, Class<?>> paramMap) { HashMap localHashMap = null; if (paramMap != null) { int i = paramMap.size(); localHashMap = null; if (i > 0) { localHashMap = new HashMap(paramMap.size()); Iterator localIterator = paramMap.entrySet().iterator(); while (localIterator.hasNext()) { Map.Entry localEntry = (Map.Entry)localIterator.next(); localHashMap.put(new ClassKey((Class)localEntry.getKey()), localEntry.getValue()); } } } this._mixInAnnotationsShared = false; this._mixInAnnotations = localHashMap; }
/** * Method used to add a mapping from specific type -- and only that * type -- to specified serializer. This means that binding is not * used for sub-types. It also means that no such mappings are to * be defined for abstract classes or interfaces: and if an attempt * is made, {@link IllegalArgumentException} will be thrown to * indicate caller error. * * @param forClass Class for which specified serializer is to be * used. May be more specific type than what serializer indicates, * but must be compatible (same or sub-class) */ public <T> void addSpecificMapping(Class<? extends T> forClass, JsonSerializer<T> ser) { ClassKey key = new ClassKey(forClass); /* First, let's ensure it's not an interface or abstract class: * as those can not be instantiated, such mappings would never * get used. */ if (forClass.isInterface()) { throw new IllegalArgumentException("Can not add specific mapping for an interface ("+forClass.getName()+")"); } if (Modifier.isAbstract(forClass.getModifiers())) { throw new IllegalArgumentException("Can not add specific mapping for an abstract class ("+forClass.getName()+")"); } if (_directClassMappings == null) { _directClassMappings = new HashMap<ClassKey,JsonSerializer<?>>(); } _directClassMappings.put(key, ser); }
protected JsonDeserializer<Object> findStdBeanDeserializer(DeserializationConfig paramDeserializationConfig, DeserializerProvider paramDeserializerProvider, JavaType paramJavaType, BeanProperty paramBeanProperty) { Class localClass = paramJavaType.getRawClass(); JsonDeserializer localJsonDeserializer = (JsonDeserializer)_simpleDeserializers.get(new ClassKey(localClass)); if (localJsonDeserializer != null); do { return localJsonDeserializer; if (AtomicReference.class.isAssignableFrom(localClass)) { JavaType[] arrayOfJavaType = paramDeserializationConfig.getTypeFactory().findTypeParameters(paramJavaType, AtomicReference.class); if ((arrayOfJavaType == null) || (arrayOfJavaType.length <= 0)); for (JavaType localJavaType = TypeFactory.unknownType(); ; localJavaType = arrayOfJavaType[0]) return new AtomicReferenceDeserializer(localJavaType, paramBeanProperty); } localJsonDeserializer = this.optionalHandlers.findDeserializer(paramJavaType, paramDeserializationConfig, paramDeserializerProvider); } while (localJsonDeserializer != null); return null; }
public final void addMixInAnnotations(Class<?> paramClass1, Class<?> paramClass2) { if (this._mixInAnnotations == null) { this._mixInAnnotationsShared = false; this._mixInAnnotations = new HashMap(); } while (true) { this._mixInAnnotations.put(new ClassKey(paramClass1), paramClass2); return; if (this._mixInAnnotationsShared) { this._mixInAnnotationsShared = false; this._mixInAnnotations = new HashMap(this._mixInAnnotations); } } }
public <T> void addGenericMapping(Class<? extends T> paramClass, JsonSerializer<T> paramJsonSerializer) { ClassKey localClassKey = new ClassKey(paramClass); if (paramClass.isInterface()) { if (this._interfaceMappings == null) this._interfaceMappings = new HashMap(); this._interfaceMappings.put(localClassKey, paramJsonSerializer); return; } if (this._transitiveClassMappings == null) this._transitiveClassMappings = new HashMap(); this._transitiveClassMappings.put(localClassKey, paramJsonSerializer); }
public <T> void addSpecificMapping(Class<? extends T> paramClass, JsonSerializer<T> paramJsonSerializer) { ClassKey localClassKey = new ClassKey(paramClass); if (paramClass.isInterface()) throw new IllegalArgumentException("Can not add specific mapping for an interface (" + paramClass.getName() + ")"); if (Modifier.isAbstract(paramClass.getModifiers())) throw new IllegalArgumentException("Can not add specific mapping for an abstract class (" + paramClass.getName() + ")"); if (this._directClassMappings == null) this._directClassMappings = new HashMap(); this._directClassMappings.put(localClassKey, paramJsonSerializer); }
protected JsonSerializer<?> findCustomSerializer(Class<?> paramClass, SerializationConfig paramSerializationConfig) { ClassKey localClassKey = new ClassKey(paramClass); if (this._directClassMappings != null) { JsonSerializer localJsonSerializer4 = (JsonSerializer)this._directClassMappings.get(localClassKey); if (localJsonSerializer4 != null) return localJsonSerializer4; } if ((paramClass.isEnum()) && (this._enumSerializerOverride != null)) return this._enumSerializerOverride; if (this._transitiveClassMappings != null) for (Object localObject2 = paramClass; localObject2 != null; localObject2 = ((Class)localObject2).getSuperclass()) { localClassKey.reset((Class)localObject2); JsonSerializer localJsonSerializer3 = (JsonSerializer)this._transitiveClassMappings.get(localClassKey); if (localJsonSerializer3 != null) return localJsonSerializer3; } if (this._interfaceMappings != null) { localClassKey.reset(paramClass); JsonSerializer localJsonSerializer1 = (JsonSerializer)this._interfaceMappings.get(localClassKey); if (localJsonSerializer1 != null) return localJsonSerializer1; for (Object localObject1 = paramClass; localObject1 != null; localObject1 = ((Class)localObject1).getSuperclass()) { JsonSerializer localJsonSerializer2 = _findInterfaceMapping((Class)localObject1, localClassKey); if (localJsonSerializer2 != null) return localJsonSerializer2; } } return (JsonSerializer<?>)(JsonSerializer<?>)null; }
private void _addSerializer(Class<?> paramClass, JsonSerializer<?> paramJsonSerializer) { ClassKey localClassKey = new ClassKey(paramClass); if (paramClass.isInterface()) { if (this._interfaceMappings == null) this._interfaceMappings = new HashMap(); this._interfaceMappings.put(localClassKey, paramJsonSerializer); return; } if (this._classMappings == null) this._classMappings = new HashMap(); this._classMappings.put(localClassKey, paramJsonSerializer); }
public SimpleKeyDeserializers addDeserializer(Class<?> paramClass, KeyDeserializer paramKeyDeserializer) { if (this._classMappings == null) this._classMappings = new HashMap(); this._classMappings.put(new ClassKey(paramClass), paramKeyDeserializer); return this; }
public <T> void addDeserializer(Class<T> paramClass, JsonDeserializer<? extends T> paramJsonDeserializer) { ClassKey localClassKey = new ClassKey(paramClass); if (this._classMappings == null) this._classMappings = new HashMap(); this._classMappings.put(localClassKey, paramJsonDeserializer); }
public JsonDeserializer<?> findArrayDeserializer(ArrayType paramArrayType, DeserializationConfig paramDeserializationConfig, DeserializerProvider paramDeserializerProvider, BeanProperty paramBeanProperty, TypeDeserializer paramTypeDeserializer, JsonDeserializer<?> paramJsonDeserializer) throws JsonMappingException { if (this._classMappings == null) return null; return (JsonDeserializer)this._classMappings.get(new ClassKey(paramArrayType.getRawClass())); }
public JsonDeserializer<?> findBeanDeserializer(JavaType paramJavaType, DeserializationConfig paramDeserializationConfig, DeserializerProvider paramDeserializerProvider, BeanDescription paramBeanDescription, BeanProperty paramBeanProperty) throws JsonMappingException { if (this._classMappings == null) return null; return (JsonDeserializer)this._classMappings.get(new ClassKey(paramJavaType.getRawClass())); }
public JsonDeserializer<?> findCollectionDeserializer(CollectionType paramCollectionType, DeserializationConfig paramDeserializationConfig, DeserializerProvider paramDeserializerProvider, BeanDescription paramBeanDescription, BeanProperty paramBeanProperty, TypeDeserializer paramTypeDeserializer, JsonDeserializer<?> paramJsonDeserializer) throws JsonMappingException { if (this._classMappings == null) return null; return (JsonDeserializer)this._classMappings.get(new ClassKey(paramCollectionType.getRawClass())); }
public JsonDeserializer<?> findCollectionLikeDeserializer(CollectionLikeType paramCollectionLikeType, DeserializationConfig paramDeserializationConfig, DeserializerProvider paramDeserializerProvider, BeanDescription paramBeanDescription, BeanProperty paramBeanProperty, TypeDeserializer paramTypeDeserializer, JsonDeserializer<?> paramJsonDeserializer) throws JsonMappingException { if (this._classMappings == null) return null; return (JsonDeserializer)this._classMappings.get(new ClassKey(paramCollectionLikeType.getRawClass())); }
public JsonDeserializer<?> findEnumDeserializer(Class<?> paramClass, DeserializationConfig paramDeserializationConfig, BeanDescription paramBeanDescription, BeanProperty paramBeanProperty) throws JsonMappingException { if (this._classMappings == null) return null; return (JsonDeserializer)this._classMappings.get(new ClassKey(paramClass)); }
public JsonDeserializer<?> findMapDeserializer(MapType paramMapType, DeserializationConfig paramDeserializationConfig, DeserializerProvider paramDeserializerProvider, BeanDescription paramBeanDescription, BeanProperty paramBeanProperty, KeyDeserializer paramKeyDeserializer, TypeDeserializer paramTypeDeserializer, JsonDeserializer<?> paramJsonDeserializer) throws JsonMappingException { if (this._classMappings == null) return null; return (JsonDeserializer)this._classMappings.get(new ClassKey(paramMapType.getRawClass())); }
public JsonDeserializer<?> findMapLikeDeserializer(MapLikeType paramMapLikeType, DeserializationConfig paramDeserializationConfig, DeserializerProvider paramDeserializerProvider, BeanDescription paramBeanDescription, BeanProperty paramBeanProperty, KeyDeserializer paramKeyDeserializer, TypeDeserializer paramTypeDeserializer, JsonDeserializer<?> paramJsonDeserializer) throws JsonMappingException { if (this._classMappings == null) return null; return (JsonDeserializer)this._classMappings.get(new ClassKey(paramMapLikeType.getRawClass())); }
public JsonDeserializer<?> findTreeNodeDeserializer(Class<? extends JsonNode> paramClass, DeserializationConfig paramDeserializationConfig, BeanProperty paramBeanProperty) throws JsonMappingException { if (this._classMappings == null) return null; return (JsonDeserializer)this._classMappings.get(new ClassKey(paramClass)); }
public <T> SimpleAbstractTypeResolver addMapping(Class<T> paramClass, Class<? extends T> paramClass1) { if (paramClass == paramClass1) throw new IllegalArgumentException("Can not add mapping from class to itself"); if (!paramClass.isAssignableFrom(paramClass1)) throw new IllegalArgumentException("Can not add mapping from class " + paramClass.getName() + " to " + paramClass1.getName() + ", as latter is not a subtype of former"); if (!Modifier.isAbstract(paramClass.getModifiers())) throw new IllegalArgumentException("Can not add mapping from class " + paramClass.getName() + " since it is not abstract"); this._mappings.put(new ClassKey(paramClass), paramClass1); return this; }
public JavaType findTypeMapping(DeserializationConfig paramDeserializationConfig, JavaType paramJavaType) { Class localClass1 = paramJavaType.getRawClass(); Class localClass2 = (Class)this._mappings.get(new ClassKey(localClass1)); if (localClass2 == null) return null; return paramJavaType.narrowBy(localClass2); }
public <T> void addSpecificMapping(Class<T> paramClass, JsonDeserializer<? extends T> paramJsonDeserializer) { ClassKey localClassKey = new ClassKey(paramClass); if (this._directClassMappings == null) this._directClassMappings = new HashMap(); this._directClassMappings.put(localClassKey, paramJsonDeserializer); }
public JsonDeserializer<?> createArrayDeserializer(DeserializationConfig paramDeserializationConfig, DeserializerProvider paramDeserializerProvider, ArrayType paramArrayType, BeanProperty paramBeanProperty) throws JsonMappingException { ClassKey localClassKey = new ClassKey(paramArrayType.getRawClass()); if (this._directClassMappings != null) { JsonDeserializer localJsonDeserializer = (JsonDeserializer)this._directClassMappings.get(localClassKey); if (localJsonDeserializer != null) return localJsonDeserializer; } return super.createArrayDeserializer(paramDeserializationConfig, paramDeserializerProvider, paramArrayType, paramBeanProperty); }
public JsonDeserializer<Object> createBeanDeserializer(DeserializationConfig paramDeserializationConfig, DeserializerProvider paramDeserializerProvider, JavaType paramJavaType, BeanProperty paramBeanProperty) throws JsonMappingException { ClassKey localClassKey = new ClassKey(paramJavaType.getRawClass()); if (this._directClassMappings != null) { JsonDeserializer localJsonDeserializer = (JsonDeserializer)this._directClassMappings.get(localClassKey); if (localJsonDeserializer != null) return localJsonDeserializer; } return super.createBeanDeserializer(paramDeserializationConfig, paramDeserializerProvider, paramJavaType, paramBeanProperty); }
public JsonDeserializer<?> createEnumDeserializer(DeserializationConfig paramDeserializationConfig, DeserializerProvider paramDeserializerProvider, JavaType paramJavaType, BeanProperty paramBeanProperty) throws JsonMappingException { if (this._directClassMappings != null) { ClassKey localClassKey = new ClassKey(paramJavaType.getRawClass()); JsonDeserializer localJsonDeserializer = (JsonDeserializer)this._directClassMappings.get(localClassKey); if (localJsonDeserializer != null) return localJsonDeserializer; } return super.createEnumDeserializer(paramDeserializationConfig, paramDeserializerProvider, paramJavaType, paramBeanProperty); }
protected SerializationConfig(SerializationConfig src, HashMap<ClassKey,Class<?>> mixins, TypeResolverBuilder<?> typer, VisibilityChecker<?> vc) { _classIntrospector = src._classIntrospector; _annotationIntrospector = src._annotationIntrospector; _featureFlags = src._featureFlags; _dateFormat = src._dateFormat; _serializationInclusion = src._serializationInclusion; _serializationView = src._serializationView; _mixInAnnotations = mixins; _typer = typer; _visibilityChecker = vc; }
/** * Method that is called to create a non-shared copy of the configuration * to be used for a serialization operation. * Note that if sub-classing * and sub-class has additional instance methods, * this method <b>must</b> be overridden to produce proper sub-class * instance. */ //@Override public SerializationConfig createUnshared(TypeResolverBuilder<?> typer, VisibilityChecker<?> vc) { HashMap<ClassKey,Class<?>> mixins = _mixInAnnotations; _mixInAnnotationsShared = true; return new SerializationConfig(this, mixins, typer, vc); }
public void addMixInAnnotations(Class<?> target, Class<?> mixinSource) { if (_mixInAnnotations == null || _mixInAnnotationsShared) { _mixInAnnotationsShared = false; _mixInAnnotations = new HashMap<ClassKey,Class<?>>(); } _mixInAnnotations.put(new ClassKey(target), mixinSource); }
/** * Helper method called to (try to) locate deserializer for given sub-type of * type that this deserializer handles. */ protected JsonDeserializer<Object> _findSubclassDeserializer(DeserializationContext ctxt, Object bean, TokenBuffer unknownTokens) throws IOException, JsonProcessingException { JsonDeserializer<Object> subDeser; // First: maybe we have already created sub-type deserializer? synchronized (this) { subDeser = (_subDeserializers == null) ? null : _subDeserializers.get(new ClassKey(bean.getClass())); } if (subDeser != null) { return subDeser; } // If not, maybe we can locate one. First, need provider DeserializerProvider deserProv = ctxt.getDeserializerProvider(); if (deserProv != null) { JavaType type = TypeFactory.type(bean.getClass()); subDeser = deserProv.findValueDeserializer(ctxt.getConfig(), type, null, "*this*"); // Also, need to cache it if (subDeser != null) { synchronized (this) { if (_subDeserializers == null) { _subDeserializers = new HashMap<ClassKey,JsonDeserializer<Object>>();; } _subDeserializers.put(new ClassKey(bean.getClass()), subDeser); } } } return subDeser; }
protected DeserializationConfig(DeserializationConfig src, HashMap<ClassKey,Class<?>> mixins, TypeResolverBuilder<?> typer, VisibilityChecker<?> vc) { _classIntrospector = src._classIntrospector; _annotationIntrospector = src._annotationIntrospector; _featureFlags = src._featureFlags; _problemHandlers = src._problemHandlers; _dateFormat = src._dateFormat; _mixInAnnotations = mixins; _typer = typer; _visibilityChecker = vc; }
/** * Method that is called to create a non-shared copy of the configuration * to be used for a deserialization operation. * Note that if sub-classing * and sub-class has additional instance methods, * this method <b>must</b> be overridden to produce proper sub-class * instance. */ //@Override public DeserializationConfig createUnshared(TypeResolverBuilder<?> typer, VisibilityChecker<?> vc) { HashMap<ClassKey,Class<?>> mixins = _mixInAnnotations; _mixInAnnotationsShared = true; return new DeserializationConfig(this, mixins, typer, vc); }