public abstract class Identifier extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<Identifier>, net.minidev.json.JSONAware
Extending classes must override the equals(java.lang.Object)
method.
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_BYTE_LENGTH
The default byte length of generated identifiers.
|
Constructor and Description |
---|
Identifier()
Creates a new identifier with a randomly generated 256-bit
(32-byte) value, Base64URL-encoded.
|
Identifier(int byteLength)
Creates a new identifier with a randomly generated value of the
specified byte length, Base64URL-encoded.
|
Identifier(java.lang.String value)
Creates a new identifier with the specified value.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Identifier other) |
abstract boolean |
equals(java.lang.Object object)
Overrides
Object.equals() . |
java.lang.String |
getValue()
Returns the value of this identifier.
|
int |
hashCode()
Overrides
Object.hashCode() . |
java.lang.String |
toJSONString()
Returns the JSON string representation of this identifier.
|
java.lang.String |
toString() |
public static final int DEFAULT_BYTE_LENGTH
public Identifier(java.lang.String value)
value
- The identifier value. Must not be null
or empty
string.public Identifier(int byteLength)
byteLength
- The byte length of the value to generate. Must be
greater than one.public Identifier()
public java.lang.String getValue()
public java.lang.String toJSONString()
toJSONString
in interface net.minidev.json.JSONAware
public java.lang.String toString()
toString
in class java.lang.Object
getValue()
public int compareTo(Identifier other)
compareTo
in interface java.lang.Comparable<Identifier>
public int hashCode()
Object.hashCode()
.hashCode
in class java.lang.Object
public abstract boolean equals(java.lang.Object object)
Object.equals()
.equals
in class java.lang.Object
object
- The object to compare to.true
if the objects have the same value, otherwise
false
.Copyright © 2015 Connect2id Ltd.. All Rights Reserved.