Class OIDGenerator
java.lang.Object
net.simplace.core.service.OIDGenerator
This class acts as a factory for unique object identifiers.
- Author:
- Andreas Enders
-
Method Summary
Modifier and TypeMethodDescriptionlongcreateID()Creates an object identifier as a 64 bit random number.Creates an object identifier as a string value without prefix.Creates an object identifier as a string value.static OIDGeneratorReturns the singleton instance of OIDGenerator, creating it on first call.
-
Method Details
-
getInstance
Returns the singleton instance of OIDGenerator, creating it on first call.- Returns:
- singleton instance of OIDGenerator
-
createOID
Creates an object identifier as a string value without prefix.- Returns:
- an object identifier of the form
-CreationTime-Random - See Also:
-
createID
public long createID()Creates an object identifier as a 64 bit random number. Uniqueness is not checked.- Returns:
- a random long value
-
createOID
Creates an object identifier as a string value.Format:
StartString-CreationTime-Random, where- StartString is the given prefix,
- CreationTime is the time in milliseconds since January 1 1970,
- Random is a non-negative 64 bit random number.
- Parameters:
aStartString- prefix of the identifier- Returns:
- an object identifier as a string value
-