@Target(value={ANNOTATION_TYPE,METHOD,FIELD,TYPE,PARAMETER}) @Retention(value=RUNTIME) public @interface JsonSerialize
An example annotation would be:
  @JsonSerialize(using=MySerializer.class,
    as=MySubClass.class,
    typing=JsonSerialize.Typing.STATIC
  )
 (which would be redundant, since some properties block others:
 specifically, 'using' has precedence over 'as', which has precedence
 over 'typing' setting)| Modifier and Type | Optional Element and Description | 
|---|---|
| Class<?> | asSupertype (of declared type, which itself is supertype of runtime type)
 to use as type when locating serializer to use. | 
| Class<?> | contentAsConcrete type to serialize content value (elements
 of a Collection/array, values of Maps) as,
 instead of type otherwise declared. | 
| Class<? extends Converter> | contentConverterSimilar to  converter(), but used for values of structures types
 (List, arrays, Maps). | 
| Class<? extends JsonSerializer> | contentUsingSerializer class to use for serializing contents (elements
 of a Collection/array, values of Maps) of annotated property. | 
| Class<? extends Converter> | converterWhich helper object is to be used to convert type into something
 that Jackson knows how to serialize; either because base type
 can not be serialized easily, or just to alter serialization. | 
| JsonSerialize.Inclusion | includeDeprecated. 
 As of Jackson 2.0, this annotation has been replaced
    by  JsonInclude | 
| Class<?> | keyAsConcrete type to serialize keys of  Mapas,
 instead of type otherwise declared. | 
| Class<? extends JsonSerializer> | keyUsingSerializer class to use for serializing Map keys
 of annotated property. | 
| Class<? extends JsonSerializer> | nullsUsingSerializer class to use for serializing nulls for properties that
 are annotated, instead of the
 default null serializer. | 
| JsonSerialize.Typing | typingWhether type detection used is dynamic or static: that is,
 whether actual runtime type is used (dynamic), or just the
 declared type (static). | 
| Class<? extends JsonSerializer> | usingSerializer class to use for
 serializing associated value. | 
public abstract Class<? extends JsonSerializer> using
public abstract Class<? extends JsonSerializer> contentUsing
public abstract Class<? extends JsonSerializer> keyUsing
public abstract Class<? extends JsonSerializer> nullsUsing
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 specifies
 serializer, whereas this would only be used to locate the
 serializer)
 and value of this annotation property is ignored.
public abstract Class<?> contentAs
public abstract JsonSerialize.Typing typing
 Note that Jackson 2.3 changed default to DEFAULT_TYPING,
 which is roughly same as saying "whatever".
 This is important as it allows avoiding accidental overrides
 at property level.
public abstract Class<? extends Converter> converter
public abstract Class<? extends Converter> contentConverter
converter(), but used for values of structures types
 (List, arrays, Maps).
 Note that this property does NOT have effect when used as Class annotation;
 it can only be used as property annotation: this because association between
 container and value types is loose and as such converters seldom make sense
 for such usage.@Deprecated public abstract JsonSerialize.Inclusion include
JsonInclude
 This property has been replaced by special-purpose JsonInclude
 annotation, introduced in Jackson 2.0.
 Note that Jackson 2.3 changed default to DEFAULT_INCLUSION,
 which is roughly same as saying "whatever". This is important because
 it allows hierarchic default values to be used.
Copyright © 2017 JBoss by Red Hat. All rights reserved.