public static final class ObjectIdGenerators.UUIDGenerator extends ObjectIdGenerators.Base<java.util.UUID>
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
Modifier and Type | Field and Description |
---|---|
private static long |
serialVersionUID |
_scope
Modifier | Constructor and Description |
---|---|
|
UUIDGenerator() |
private |
UUIDGenerator(java.lang.Class<?> scope) |
Modifier and Type | Method and Description |
---|---|
boolean |
canUseFor(ObjectIdGenerator<?> gen)
Since UUIDs are always unique, let's fully ignore scope definition
|
ObjectIdGenerator<java.util.UUID> |
forScope(java.lang.Class<?> scope)
Can just return base instance since this is essentially scopeless
|
java.util.UUID |
generateId(java.lang.Object forPojo)
Method used for generating a new Object Identifier to serialize
for given POJO.
|
ObjectIdGenerator.IdKey |
key(java.lang.Object key)
Method for constructing key to use for ObjectId-to-POJO maps.
|
ObjectIdGenerator<java.util.UUID> |
newForSerialization(java.lang.Object context)
Can just return base instance since this is essentially scopeless
|
getScope
isValidReferencePropertyName, maySerializeAsObject
private static final long serialVersionUID
public UUIDGenerator()
private UUIDGenerator(java.lang.Class<?> scope)
public ObjectIdGenerator<java.util.UUID> forScope(java.lang.Class<?> scope)
forScope
in class ObjectIdGenerator<java.util.UUID>
public ObjectIdGenerator<java.util.UUID> newForSerialization(java.lang.Object context)
newForSerialization
in class ObjectIdGenerator<java.util.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 java.util.UUID generateId(java.lang.Object forPojo)
ObjectIdGenerator
generateId
in class ObjectIdGenerators.Base<java.util.UUID>
forPojo
- POJO for which identifier is neededpublic ObjectIdGenerator.IdKey key(java.lang.Object key)
ObjectIdGenerator
key
in class ObjectIdGenerator<java.util.UUID>
public boolean canUseFor(ObjectIdGenerator<?> gen)
canUseFor
in class ObjectIdGenerators.Base<java.util.UUID>