|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Target(value={ANNOTATION_TYPE,TYPE,FIELD,METHOD,PARAMETER}) @Retention(value=RUNTIME) public @interface JsonIdentityInfo
Annotation used for indicating that values of annotated type or property should be serializing so that instances either contain additional object identifier (in addition actual object properties), or as a reference that consists of an object id that refers to a full serialization. In practice this is done by serializing the first instance as full object and object identity, and other references to the object as reference values.
There are two main approaches to generating object identifier:
either using a generator (either one of standard ones, or a custom
generator), or using a value of a property. The latter case is
indicated by using a placeholder generator marker
ObjectIdGenerators.PropertyGenerator
; former by using explicit generator.
Object id has to be serialized as a property in case of POJOs;
object identity is currently NOT support for JSON Array types
(Java arrays or Lists) or Java Map types.
Finally, note that generator type of ObjectIdGenerators.None
indicates that no Object Id should be included or used: it is included
to allow suppressing Object Ids using mix-in annotations.
Required Element Summary | |
---|---|
Class<? extends ObjectIdGenerator<?>> |
generator
Generator to use for producing Object Identifier for objects: either one of pre-defined generators from ObjectIdGenerator , or a custom generator. |
Optional Element Summary | |
---|---|
String |
property
Name of JSON property in which Object Id will reside: also, if "from property" marker generator is used, identifies property that will be accessed to get type id. |
Class<?> |
scope
Scope is used to define applicability of an Object Id: all ids must be unique within their scope; where scope is defined as combination of this value and generator type. |
Element Detail |
---|
public abstract Class<? extends ObjectIdGenerator<?>> generator
ObjectIdGenerator
, or a custom generator.
Defined as class to instantiate.
Note that special type
ObjectIdGenerators.None
can be used to disable inclusion of Object Ids.
public abstract String property
Default value is @id
.
public abstract Class<?> scope
Scope is used for determining how many generators are needed; more than one scope is typically only needed if external Object Ids have overlapping value domains (i.e. are only unique within some limited scope)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |