|
Cumulus4j API (1.2.0) |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.cumulus4j.keymanager.back.shared.IdentifierUtil
public class IdentifierUtil
Utility class for identifiers used within Cumulus4j.
| Constructor Summary | |
|---|---|
IdentifierUtil()
|
|
| Method Summary | |
|---|---|
static String |
createRandomID()
Create a random String identifier with a sufficiently unique length. |
static String |
createRandomID(int length)
Create a random String identifier with a specified length. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public IdentifierUtil()
| Method Detail |
|---|
public static String createRandomID()
Create a random String identifier with a sufficiently unique length.
This method calls createRandomID(int) with a length of 25.
The length of 25 is chosen, because it produces an identifier
which has about the same uniqueness as UUID.randomUUID(). This is because
the String has 36 ^ 25 (approximately equals 2 ^ 129) possible values while a UUID
has 2 ^ 128 possible values and both identifiers are created using the same
method (SecureRandom.nextBytes(byte[])).
String.createRandomID(int)public static String createRandomID(int length)
Create a random String identifier with a specified length.
The generated identifier will contain
only the characters '0'...'9' and 'a'...'z' and will have the specified length.
This method uses a SecureRandom (just like UUID.randomUUID()). With a length
of 25, the identifier will have about the same uniqueness as a UUID - see
createRandomID().
length - the number of chars in the result.
String with the given length.createRandomID()
|
Cumulus4j API (1.2.0) |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||