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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()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
ObjIdhas already been created for the specifiedtypeNameandstringby this instance, it will be returned. Otherwise, a randomObjIdfor which no object exists in the specifiedTransactionis 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
typeNameandstring - Throws:
IllegalArgumentException- if any parameter is null
-
clear
public void clear()Clear this instance.
-