public class LinearPointer<T extends LinearState> extends StatePointer<T>
class LinearPointer
allows a interface ContractState
to "point" to another interface LinearState
creating a "many-to-one" relationship
between all the states containing the pointer to a particular interface LinearState
and the interface LinearState
being pointed to.
Using the class LinearPointer
is useful when one state depends on the data contained within another state that evolves
independently. When using class LinearPointer
it is worth noting:
The node performing the resolution may not have seen any interface LinearState
s with the specified linearId, as such the
vault query in LinearPointer.resolve
will return null and LinearPointer.resolve
will throw an exception
The node performing the resolution may not have the latest version of the interface LinearState
and therefore will return
an older version of the interface LinearState
. As the pointed-to state will be added as a reference state to the transaction
then the transaction with such a reference state cannot be committed to the ledger until the most up-to-date version
of the interface LinearState
is available. See reference states documentation on docs.corda.net for more info.
class LinearPointer
,
interface ContractState
,
interface LinearState
,
interface LinearState
,
interface LinearState
,
class LinearPointer
,
class LinearPointer
,
interface LinearState
,
linearId,
LinearPointer.resolve
,
LinearPointer.resolve
,
interface LinearState
,
interface LinearState
,
interface LinearState
StatePointer.Companion
Companion
Constructor and Description |
---|
LinearPointer(UniqueIdentifier pointer,
java.lang.Class<T> type,
boolean isResolved)
class LinearPointer allows a interface ContractState to "point" to another interface LinearState creating a "many-to-one" relationship
between all the states containing the pointer to a particular interface LinearState and the interface LinearState being pointed to.
Using the class LinearPointer is useful when one state depends on the data contained within another state that evolves
independently. When using class LinearPointer it is worth noting: |
LinearPointer(UniqueIdentifier pointer,
java.lang.Class<T> type)
Allows this class to be evolved through backwards compatibility with version 1 of this class.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object other) |
UniqueIdentifier |
getPointer()
An identifier for the
|
java.lang.Class<T> |
getType()
Type of the state which is being pointed to.
|
int |
hashCode() |
boolean |
isResolved()
Determines whether the state pointer should be resolved to a reference input when used in a transaction.
|
StateAndRef<T> |
resolve(ServiceHub services)
Resolves a
class LinearPointer using the class UniqueIdentifier contained in the pointer property. Returns a
class StateAndRef containing the latest version of the interface LinearState that the node calling LinearPointer.resolve is aware of. |
StateAndRef<T> |
resolve(LedgerTransaction ltx)
Resolves a
class StatePointer to a class StateAndRef from inside a class LedgerTransaction . The intuition here is that all
of the pointed-to states will be included in the transaction as reference states. |
getPointer, getType, isResolved, resolve, resolve
public LinearPointer(UniqueIdentifier pointer, java.lang.Class<T> type, boolean isResolved)
class LinearPointer
allows a interface ContractState
to "point" to another interface LinearState
creating a "many-to-one" relationship
between all the states containing the pointer to a particular interface LinearState
and the interface LinearState
being pointed to.
Using the class LinearPointer
is useful when one state depends on the data contained within another state that evolves
independently. When using class LinearPointer
it is worth noting:
The node performing the resolution may not have seen any interface LinearState
s with the specified linearId, as such the
vault query in LinearPointer.resolve
will return null and LinearPointer.resolve
will throw an exception
The node performing the resolution may not have the latest version of the interface LinearState
and therefore will return
an older version of the interface LinearState
. As the pointed-to state will be added as a reference state to the transaction
then the transaction with such a reference state cannot be committed to the ledger until the most up-to-date version
of the interface LinearState
is available. See reference states documentation on docs.corda.net for more info.
pointer
- An identifier for the interface ContractState
that this class StatePointer
points to.type
- Type of the state which is being pointed to.isResolved
- Determines whether the state pointer should be resolved to a reference input when used in a transaction.class LinearPointer
,
interface ContractState
,
interface LinearState
,
interface LinearState
,
interface LinearState
,
class LinearPointer
,
class LinearPointer
,
interface LinearState
,
linearId,
LinearPointer.resolve
,
LinearPointer.resolve
,
interface LinearState
,
interface LinearState
,
interface LinearState
public LinearPointer(UniqueIdentifier pointer, java.lang.Class<T> type)
Allows this class to be evolved through backwards compatibility with version 1 of this class.
pointer
- The unique identifier that this points to.type
- The underlying interface LinearState
type that this points to.public StateAndRef<T> resolve(ServiceHub services)
Resolves a class LinearPointer
using the class UniqueIdentifier
contained in the pointer property. Returns a
class StateAndRef
containing the latest version of the interface LinearState
that the node calling LinearPointer.resolve
is aware of.
services
- a interface ServiceHub
implementation is required to perform a vault query.class LinearPointer
,
class UniqueIdentifier
,
class StateAndRef
,
interface LinearState
,
LinearPointer.resolve
public StateAndRef<T> resolve(LedgerTransaction ltx)
Resolves a class StatePointer
to a class StateAndRef
from inside a class LedgerTransaction
. The intuition here is that all
of the pointed-to states will be included in the transaction as reference states.
ltx
- the class LedgerTransaction
containing the StatePointer.getPointer
and pointed-to states.class StatePointer
,
class StateAndRef
,
class LedgerTransaction
public boolean equals(java.lang.Object other)
public int hashCode()
public UniqueIdentifier getPointer()
An identifier for the
interface ContractState
that this class StatePointer
points to.
interface ContractState
,
class StatePointer
public java.lang.Class<T> getType()
Type of the state which is being pointed to.
public boolean isResolved()
Determines whether the state pointer should be resolved to a reference input when used in a transaction.