Package org.openremote.model.util
Class UniqueIdentifierGenerator
java.lang.Object
org.openremote.model.util.UniqueIdentifierGenerator
Generate a globally unique identifier value.
This is a Hibernate identifier generator as well: Assigns a random UUID if the persisted entity instance is of
type IdentifiableEntity
and if its IdentifiableEntity.getId()
method returns null
.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final com.fasterxml.uuid.impl.NameBasedGenerator
protected static final com.fasterxml.uuid.impl.RandomBasedGenerator
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
Generates a random UUID value encoded as Base62, 22 characters long.static String
generateId
(byte[] bytes) Generates the same UUID value encoded as Base62, 22 characters long, if the bytes are the same.static String
generateId
(String name) Generates the same UUID value encoded as Base62, 22 characters long, if the name is the same.
-
Field Details
-
randomGenerator
protected static final com.fasterxml.uuid.impl.RandomBasedGenerator randomGenerator -
nameGenerator
protected static final com.fasterxml.uuid.impl.NameBasedGenerator nameGenerator
-
-
Constructor Details
-
UniqueIdentifierGenerator
public UniqueIdentifierGenerator()
-
-
Method Details
-
generateId
Generates a random UUID value encoded as Base62, 22 characters long. -
generateId
Generates the same UUID value encoded as Base62, 22 characters long, if the name is the same. -
generateId
Generates the same UUID value encoded as Base62, 22 characters long, if the bytes are the same.
-