Package org.eclnt.util.valuemgmt
Class UniqueIdCreator
java.lang.Object
org.eclnt.util.valuemgmt.UniqueIdCreator
Utility class for creating unique ids.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic long
Increases the process counter that is used increateId()
.static String
createId()
Creates a unique id based on a prefix which is built one time per process.static String
Creates a unique id based on current time stamp, random number and process counter.static String
Creates a UUID according to UUID management of Java 1.7.
-
Constructor Details
-
UniqueIdCreator
public UniqueIdCreator()
-
-
Method Details
-
createId
Creates a unique id based on a prefix which is built one time per process. The prefix consists out of the current timestamp and a random value. Values are then created by adding a counter. This id is a counted if and must NOT be used for any purpose demanding some unique id that is not predictable! -
createRandomId
Creates a unique id based on current time stamp, random number and process counter. -
createCounter
public static long createCounter()Increases the process counter that is used increateId()
. -
createUUID
Creates a UUID according to UUID management of Java 1.7. The result is a 36 char long UUID following the common UUID format for 128bit based UUIDs.
If Java 1.7 is not available then the methodcreateRandomId()
is used for creating the id.
-