|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.fasterxml.jackson.annotation.ObjectIdGenerator<T>
T
- Type of Object Identifiers produced.public abstract class ObjectIdGenerator<T>
Definition of API used for constructing Object Identifiers
(as annotated using JsonIdentityInfo
).
Also defines factory methods used for creating instances
for serialization, deserialization.
Nested Class Summary | |
---|---|
static class |
ObjectIdGenerator.IdKey
Simple key class that can be used as a key for ObjectId-to-POJO mappings, when multiple ObjectId types and scopes are used. |
Constructor Summary | |
---|---|
ObjectIdGenerator()
|
Method Summary | |
---|---|
abstract boolean |
canUseFor(ObjectIdGenerator<?> gen)
Method called to check whether this generator instance can be used for Object Ids of specific generator type and scope; determination is based by passing a configured "blueprint" (prototype) instance; from which the actual instances are created (using newForSerialization(java.lang.Object) ). |
abstract ObjectIdGenerator<T> |
forScope(Class<?> scope)
Factory method to create a blueprint instance for specified scope. |
abstract T |
generateId(Object forPojo)
Method used for generating a new Object Identifier to serialize for given POJO. |
abstract Class<?> |
getScope()
|
abstract ObjectIdGenerator.IdKey |
key(Object key)
Method for constructing key to use for ObjectId-to-POJO maps. |
abstract ObjectIdGenerator<T> |
newForSerialization(Object context)
Factory method called to create a new instance to use for serialization: needed since generators may have state (next id to produce). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ObjectIdGenerator()
Method Detail |
---|
public abstract Class<?> getScope()
public abstract boolean canUseFor(ObjectIdGenerator<?> gen)
newForSerialization(java.lang.Object)
).
public abstract ObjectIdGenerator<T> forScope(Class<?> scope)
public abstract ObjectIdGenerator<T> newForSerialization(Object context)
Note that actual type of 'context' is
com.fasterxml.jackson.databind.SerializerProvider
,
but can not be declared here as type itself (as well as call
to this object) comes from databind package.
context
- Serialization context object used (of type
com.fasterxml.jackson.databind.SerializerProvider
;
may be needed by more complex generators to access contextual
information such as configuration.public abstract ObjectIdGenerator.IdKey key(Object key)
public abstract T generateId(Object forPojo)
forPojo
- POJO for which identifier is needed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |