com.r3corda.core.contracts / UniqueIdentifier

# UniqueIdentifier

`data class UniqueIdentifier : Comparable<UniqueIdentifier>`

This class provides a truly unique identifier of a trade, state, or other business object.

### Parameters

`externalId` - If there is an existing weak identifier e.g. trade reference id. This should be set here the first time a UniqueIdentifier identifier is created as part of an issue, 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.

### Constructors

<init> | `UniqueIdentifier(externalId: String? = null, id: UUID = UUID.randomUUID())` This class provides a truly unique identifier of a trade, state, or other business object.

### Properties

externalId | `val externalId: String?`
id | `val id: UUID`

### Functions

compareTo | `fun compareTo(other: UniqueIdentifier): Int`
toString | `fun toString(): String`

### Companion Object Functions

fromString | `fun fromString(name: String): UniqueIdentifier`