Annotation Interface JsonDeserialize
Annotation use for configuring deserialization aspects, by attaching
to "setter" methods or fields, or to value classes.
When annotating value classes, configuration is used for instances
of the value class but can be overridden by more specific annotations
(ones that attach to methods or fields).
An example annotation would be:
@JsonDeserialize(using=MySerializer.class, as=MyHashMap.class, keyAs=MyHashKey.class, contentAs=MyHashValue.class )
NOTE: since version 1.2, annotation has also been applicable to (constructor) parameters
- Since:
- 1.1
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionClass<?>
Concrete type to deserialize values as, instead of type otherwise declared.Class<?>
Concrete type to deserialize content (elements of a Collection/array, values of Maps) values as, instead of type otherwise declared.Class<? extends JsonDeserializer<?>>
Deserializer class to use for deserializing contents (elements of a Collection/array, values of Maps) of annotated property.Class<?>
Concrete type to deserialize keys ofMap
as, instead of type otherwise declared.Class<? extends KeyDeserializer>
Deserializer class to use for deserializing Map keys of annotated property.Class<? extends JsonDeserializer<?>>
Deserializer class to use for deserializing associated value.
-
Element Details
-
using
Class<? extends JsonDeserializer<?>> usingDeserializer class to use for deserializing associated value. Depending on what is annotated, value is either an instance of annotated class (used globablly anywhere where class deserializer is needed); or only used for deserializing property access via a setter method.- Default:
- org.codehaus.jackson.map.JsonDeserializer.None.class
-
contentUsing
Class<? extends JsonDeserializer<?>> contentUsingDeserializer class to use for deserializing contents (elements of a Collection/array, values of Maps) of annotated property. Can only be used on instances (methods, fields, constructors), and not value classes themselves.- Since:
- 1.3
- Default:
- org.codehaus.jackson.map.JsonDeserializer.None.class
-
keyUsing
Class<? extends KeyDeserializer> keyUsingDeserializer class to use for deserializing Map keys of annotated property. Can only be used on instances (methods, fields, constructors), and not value classes themselves.- Since:
- 1.3
- Default:
- org.codehaus.jackson.map.KeyDeserializer.None.class
-
as
Class<?> asConcrete type to deserialize values as, instead of type otherwise declared. Must be a subtype of declared type; otherwise an exception may be thrown by deserializer.Bogus type
NoClass
can be used to indicate that declared type is used as is (i.e. this annotation property has no setting); this since annotation properties are not allowed to have null value.Note: if
using()
is also used it has precedence (since it directly specified deserializer, whereas this would only be used to locate the deserializer) and value of this annotation property is ignored.- Default:
- org.codehaus.jackson.map.annotate.NoClass.class
-
keyAs
Class<?> keyAsConcrete type to deserialize keys ofMap
as, instead of type otherwise declared. Must be a subtype of declared type; otherwise an exception may be thrown by deserializer.- Default:
- org.codehaus.jackson.map.annotate.NoClass.class
-
contentAs
Class<?> contentAsConcrete type to deserialize content (elements of a Collection/array, values of Maps) values as, instead of type otherwise declared. Must be a subtype of declared type; otherwise an exception may be thrown by deserializer.- Default:
- org.codehaus.jackson.map.annotate.NoClass.class
-