Package io.permazen.core.util
Class GeneratedIdCache
java.lang.Object
io.permazen.core.util.GeneratedIdCache
Cache for randomly generated object IDs based on unique strings.
Instances are thread safe.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear this instance.getGeneratedId
(Transaction tx, String typeName, String string) Generate an object ID for the given object type name and string.
-
Constructor Details
-
GeneratedIdCache
public GeneratedIdCache()
-
-
Method Details
-
getGeneratedId
Generate an object ID for the given object type name and string.If an
ObjId
has already been created for the specifiedtypeName
andstring
by this instance, it will be returned. Otherwise, a randomObjId
for which no object exists in the specifiedTransaction
is generated and returned.- Parameters:
tx
- transaction from which to allocate new object IDstypeName
- object type namestring
- unique string- Returns:
- unique, unallocated object ID corresponding to
typeName
andstring
- Throws:
IllegalArgumentException
- if any parameter is null
-
clear
public void clear()Clear this instance.
-