|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.fasterxml.jackson.annotation.ObjectIdGenerator<T>
com.fasterxml.jackson.annotation.ObjectIdGenerators.StringIdGenerator
public static final class ObjectIdGenerators.StringIdGenerator
Implementation that will accept arbitrary (but unique) String Ids on
deserialization, and (by default) use random UUID generation similar
to ObjectIdGenerators.UUIDGenerator
for generation ids.
This generator is most useful for cases where another system creates
String Ids (of arbitrary structure, if any), and Jackson only needs to
keep track of id-to-Object mapping. Generation also works, although if
UUIDs are always used, ObjectIdGenerators.UUIDGenerator
is a better match as it
will also validate ids being used.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.fasterxml.jackson.annotation.ObjectIdGenerator |
---|
ObjectIdGenerator.IdKey |
Constructor Summary | |
---|---|
ObjectIdGenerators.StringIdGenerator()
|
Method Summary | |
---|---|
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 ObjectIdGenerator.newForSerialization(java.lang.Object) ). |
ObjectIdGenerator<String> |
forScope(Class<?> scope)
Factory method to create a blueprint instance for specified scope. |
String |
generateId(Object forPojo)
Method used for generating a new Object Identifier to serialize for given POJO. |
ObjectIdGenerator.IdKey |
key(Object key)
Method for constructing key to use for ObjectId-to-POJO maps. |
ObjectIdGenerator<String> |
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 com.fasterxml.jackson.annotation.ObjectIdGenerator |
---|
isValidReferencePropertyName, maySerializeAsObject |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ObjectIdGenerators.StringIdGenerator()
Method Detail |
---|
public ObjectIdGenerator<String> forScope(Class<?> scope)
ObjectIdGenerator
forScope
in class ObjectIdGenerator<String>
public ObjectIdGenerator<String> newForSerialization(Object context)
ObjectIdGenerator
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.
newForSerialization
in class ObjectIdGenerator<String>
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 String generateId(Object forPojo)
ObjectIdGenerator
forPojo
- POJO for which identifier is needed
public ObjectIdGenerator.IdKey key(Object key)
ObjectIdGenerator
key
in class ObjectIdGenerator<String>
public boolean canUseFor(ObjectIdGenerator<?> gen)
ObjectIdGenerator
ObjectIdGenerator.newForSerialization(java.lang.Object)
).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |