Class InstanceId
java.lang.Object
dev.getelements.elements.sdk.cluster.id.InstanceId
- All Implemented Interfaces:
Serializable
,Comparable<dev.getelements.elements.sdk.cluster.id.HasCompoundId<dev.getelements.elements.sdk.cluster.id.V1CompoundId>>
Represents an ID for an instance.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionInstanceId
(byte[] byteRepresentation) InstanceId
(String stringRepresentation) InstanceId
(UUID instanceUuid) -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
asBytes()
asString()
Returns the compound Id string representation of thisNodeId
default int
compareTo
(dev.getelements.elements.sdk.cluster.id.HasCompoundId<dev.getelements.elements.sdk.cluster.id.V1CompoundId> o) Compares this instance with the other instance.boolean
static InstanceId
forUniqueName
(String uniqueInstanceName) Creates a newInstanceId
from the given unique instance name.dev.getelements.elements.sdk.cluster.id.V1CompoundId
getId()
getUuid()
Gets aUUID
representing the instance id.int
hashCode()
static InstanceId
loadOrGenerate
(File file) Creates a file on disk at the supplied path to hold anInstanceId
.static InstanceId
loadOrGenerate
(String path) Creates a file on disk at the supplied path to hold anInstanceId
.static InstanceId
Generates a randomly-assigned uniqueInstanceId
.toString()
static InstanceId
The Java standard valueOf method.
-
Constructor Details
-
InstanceId
-
InstanceId
public InstanceId(byte[] byteRepresentation) -
InstanceId
-
-
Method Details
-
getUuid
Gets aUUID
representing the instance id.- Returns:
- the
UUID
of thisInstanceId
-
asString
Returns the compound Id string representation of thisNodeId
- Returns:
- the string representation
-
asBytes
public byte[] asBytes() -
getId
public dev.getelements.elements.sdk.cluster.id.V1CompoundId getId() -
equals
-
hashCode
public int hashCode() -
toString
-
valueOf
The Java standard valueOf method.- Parameters:
value
- the value- Returns:
- the
InstanceId
-
randomInstanceId
Generates a randomly-assigned uniqueInstanceId
.- Returns:
- the generated
InstanceId
-
forUniqueName
Creates a newInstanceId
from the given unique instance name. The unique instance name may be any string uniquely representing the instance (such as database primary key, DNS hostname) or similar.- Parameters:
uniqueInstanceName
- the unique instance name- Returns:
- the newly created
InstanceId
-
loadOrGenerate
Creates a file on disk at the supplied path to hold anInstanceId
. A file already exists at at that location and it is a valid instance ID, it will simply return that value read from disk.- Parameters:
path
- the path to the instance ID file- Returns:
- the
InstanceId
read or generated
-
loadOrGenerate
Creates a file on disk at the supplied path to hold anInstanceId
. A file already exists at at that location and it is a valid instance ID, it will simply return that value read from disk.- Parameters:
file
- the path to the instance ID file- Returns:
- the
InstanceId
read or generated
-
compareTo
default int compareTo(dev.getelements.elements.sdk.cluster.id.HasCompoundId<dev.getelements.elements.sdk.cluster.id.V1CompoundId> o) Compares this instance with the other instance.- Specified by:
compareTo
in interfaceComparable<CompoundIdT extends Comparable<CompoundIdT>>
- Parameters:
o
- the instance- Returns:
-