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 thisNodeIddefault intcompareTo(dev.getelements.elements.sdk.cluster.id.HasCompoundId<dev.getelements.elements.sdk.cluster.id.V1CompoundId> o) Compares this instance with the other instance.booleanstatic InstanceIdforUniqueName(String uniqueInstanceName) Creates a newInstanceIdfrom the given unique instance name.dev.getelements.elements.sdk.cluster.id.V1CompoundIdgetId()getUuid()Gets aUUIDrepresenting the instance id.inthashCode()static InstanceIdloadOrGenerate(File file) Creates a file on disk at the supplied path to hold anInstanceId.static InstanceIdloadOrGenerate(String path) Creates a file on disk at the supplied path to hold anInstanceId.static InstanceIdGenerates a randomly-assigned uniqueInstanceId.toString()static InstanceIdThe Java standard valueOf method.
-
Constructor Details
-
InstanceId
-
InstanceId
public InstanceId(byte[] byteRepresentation) -
InstanceId
-
-
Method Details
-
getUuid
Gets aUUIDrepresenting the instance id.- Returns:
- the
UUIDof 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 newInstanceIdfrom 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
InstanceIdread 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
InstanceIdread 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:
compareToin interfaceComparable<CompoundIdT extends Comparable<CompoundIdT>>- Parameters:
o- the instance- Returns:
-