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
ConstructorsConstructorDescriptionCreates a new, randomSmallIdentifierusing a defaultSecureRandominstance, which is not a strong instance to avoid blocking.SmallIdentifier(long value) SmallIdentifier(String encoded) SmallIdentifier(SecureRandom secureRandom) Creates a new, randomSmallIdentifierusing the providedSecureRandomsource.SmallIdentifier(Random random) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(SmallIdentifier other) Unsigned ordering.booleanequals(SmallIdentifier other) booleanlonggetValue()inthashCode()static voidchar[]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, randomSmallIdentifierusing a defaultSecureRandominstance, 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, randomSmallIdentifierusing the providedRandomsource. -
SmallIdentifier
Creates a new, randomSmallIdentifierusing the providedSecureRandomsource. -
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:
compareToin interfaceComparable<SmallIdentifier>
-
getValue
public long getValue() -
main
-

SecureRandom.