java.lang.Object
com.aoapps.security.SmallIdentifier
- All Implemented Interfaces:
Serializable
,Comparable<SmallIdentifier>
public final class SmallIdentifier
extends Object
implements Serializable, Comparable<SmallIdentifier>
A 64-bit random identifier internally stored as a long value.
- Author:
- AO Industries, Inc.
- See Also:
-
Constructor Summary
ConstructorDescriptionCreates a new, randomSmallIdentifier
using a defaultSecureRandom
instance, which is not a strong instance to avoid blocking.SmallIdentifier
(long value) SmallIdentifier
(String encoded) SmallIdentifier
(SecureRandom secureRandom) Creates a new, randomSmallIdentifier
using the providedSecureRandom
source.SmallIdentifier
(Random random) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(SmallIdentifier other) Unsigned ordering.boolean
equals
(SmallIdentifier other) boolean
long
getValue()
int
hashCode()
static void
char[]
The external representation is a string of characters encoded in base #BASE, with Identifier#NUM_CHARACTERS characters for "value".toString()
The external representation is a string of characters encoded in base #BASE, with Identifier#NUM_CHARACTERS characters for "value".static SmallIdentifier
-
Constructor Details
-
SmallIdentifier
public SmallIdentifier()Creates a new, randomSmallIdentifier
using a defaultSecureRandom
instance, which is not a strong instance to avoid blocking. -
SmallIdentifier
Deprecated.Please useSecureRandom
. This method will stay, but will remain deprecated since it should only be used after careful consideration.Creates a new, randomSmallIdentifier
using the providedRandom
source. -
SmallIdentifier
Creates a new, randomSmallIdentifier
using the providedSecureRandom
source. -
SmallIdentifier
public SmallIdentifier(long value) -
SmallIdentifier
- Throws:
IllegalArgumentException
- See Also:
-
-
Method Details
-
valueOf
- Throws:
IllegalArgumentException
- See Also:
-
equals
-
equals
-
hashCode
public int hashCode() -
toCharArray
public char[] toCharArray()The external representation is a string of characters encoded in base #BASE, with Identifier#NUM_CHARACTERS characters for "value".- See Also:
-
toString
The external representation is a string of characters encoded in base #BASE, with Identifier#NUM_CHARACTERS characters for "value". -
compareTo
Unsigned ordering.- Specified by:
compareTo
in interfaceComparable<SmallIdentifier>
-
getValue
public long getValue() -
main
-
SecureRandom
.