data class UniqueIdentifier : Comparable<UniqueIdentifier>
This class provides a truly unique identifier of a trade, state, or other business object, bound to any existing external ID. Equality and comparison are based on the unique ID only; if two states somehow have the same UUID but different external IDs, it would indicate a problem with handling of IDs.
externalId
- Any existing weak identifier such as trade reference ID.
This should be set here the first time a UniqueIdentifier is created as part of state issuance,
or ledger on-boarding activity. This ensure that the human readable identity is paired with the strong ID.
id
- Should never be set by user code and left as default initialised.
So that the first time a state is issued this should be given a new UUID.
Subsequent copies and evolutions of a state should just copy the externalId and id fields unmodified.
UniqueIdentifier(externalId: String? = null, id: UUID = UUID.randomUUID())
This class provides a truly unique identifier of a trade, state, or other business object, bound to any existing external ID. Equality and comparison are based on the unique ID only; if two states somehow have the same UUID but different external IDs, it would indicate a problem with handling of IDs. |
val externalId: String?
Any existing weak identifier such as trade reference ID. This should be set here the first time a UniqueIdentifier is created as part of state issuance, or ledger on-boarding activity. This ensure that the human readable identity is paired with the strong ID. |
|
val id: UUID
Should never be set by user code and left as default initialised. So that the first time a state is issued this should be given a new UUID. Subsequent copies and evolutions of a state should just copy the externalId and id fields unmodified. |
fun compareTo(other: UniqueIdentifier): Int |
|
fun equals(other: Any?): Boolean |
|
fun hashCode(): Int |
|
fun toString(): String |
fun fromString(name: String): UniqueIdentifier
Helper function for unit tests where the UUID needs to be manually initialised for consistency. |
fun Any.contextLogger(): <ERROR CLASS>
When called from a companion object, returns the logger for the enclosing class. |