@Target(value={ANNOTATION_TYPE,METHOD,FIELD,TYPE,PARAMETER}) @Retention(value=RUNTIME) public @interface JsonDeserialize
JsonDeserialize to remove the use of java.lang.reflect.* classes
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
)
| Modifier and Type | Optional Element and Description |
|---|---|
Class<?> |
as
Concrete type to deserialize values as, instead of type otherwise
declared.
|
Class<?> |
builder
Annotation for specifying if an external Builder class
is to be used for building up deserialized instances
of annotated class.
|
Class<?> |
contentAs
Concrete type to deserialize content (elements
of a Collection/array, values of Maps) values as,
instead of type otherwise declared.
|
Class<?> |
contentConverter
NOTE: This is not yet used in GwtJackson.
|
Class<?> |
contentUsing
NOTE: This is not yet used in GwtJackson.
|
Class<?> |
converter
NOTE: This is not yet used in GwtJackson.
|
Class<?> |
keyAs
Concrete type to deserialize keys of
Map as,
instead of type otherwise declared. |
Class<?> |
keyUsing
NOTE: This is not yet used in GwtJackson.
|
Class<?> |
using
NOTE: This is not yet used in GwtJackson.
|
public abstract Class<?> using
Deserializer 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.
public abstract Class<?> contentUsing
Deserializer 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.
public abstract Class<?> keyUsing
Deserializer class to use for deserializing Map keys of annotated property. Can only be used on instances (methods, fields, constructors), and not value classes themselves.
public abstract Class<?> converter
Which helper object (if any) is to be used to convert from Jackson-bound intermediate type (source type of converter) into actual property type (which must be same as result type of converter). This is often used for two-step deserialization; Jackson binds data into suitable intermediate type (like Tree representation), and converter then builds actual property type.
public abstract Class<?> contentConverter
Similar to converter(), but used for values of structures types
(List, arrays, Maps).
public abstract Class<?> as
Bogus type Void 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.
public abstract Class<?> contentAs
public abstract Class<?> builder
Copyright © 2020. All rights reserved.