public static final class ObjectIdGenerators.UUIDGenerator extends ObjectIdGenerator<T>
UUID
s as reliably
unique identifiers: downside is that resulting String is
36 characters long.
One difference to other generators is that scope is always
set as Object.class
(regardless of arguments): this
because UUIDs are globally unique, and scope has no meaning.
ObjectIdGenerator.IdKey
Constructor and Description |
---|
ObjectIdGenerators.UUIDGenerator() |
Modifier and Type | Method and Description |
---|---|
boolean |
canUseFor(ObjectIdGenerator<?> gen)
Since UUIDs are always unique, let's fully ignore scope definition
|
ObjectIdGenerator<UUID> |
forScope(Class<?> scope)
Can just return base instance since this is essentially scopeless
|
UUID |
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<UUID> |
newForSerialization(Object context)
Can just return base instance since this is essentially scopeless
|
isValidReferencePropertyName, maySerializeAsObject
public ObjectIdGenerator<UUID> forScope(Class<?> scope)
forScope
in class ObjectIdGenerator<UUID>
public ObjectIdGenerator<UUID> newForSerialization(Object context)
newForSerialization
in class ObjectIdGenerator<UUID>
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 UUID generateId(Object forPojo)
ObjectIdGenerator
forPojo
- POJO for which identifier is neededpublic ObjectIdGenerator.IdKey key(Object key)
ObjectIdGenerator
key
in class ObjectIdGenerator<UUID>
public boolean canUseFor(ObjectIdGenerator<?> gen)
Copyright © 2008–2017 FasterXML. All rights reserved.