StaticPointer
Keywords: net.corda.core.contracts.StaticPointer class
Date: 2023-09-18

net.corda.core.contracts

## Class StaticPointer<T extends ContractState>

- net.corda.core.contracts.StatePointer<T>
- - net.corda.core.contracts.StaticPointer<T>

-     public class StaticPointer<T extends ContractState>
      extends StatePointer<T>

  A `class StaticPointer` contains a pointer to a specific `class StateRef` and can be resolved by looking up the `class StateRef` via `interface ServiceHub`. There are a number of things to keep in mind when using `class StaticPointer`s:

  - The `interface ContractState` being pointed to may be spent or unspent when the pointer is resolved

  - The `interface ContractState` may not be known by the node performing the look-up in which case the `resolve` method will throw a `exception TransactionResolutionException`

  See Also:
    `class StaticPointer`, `class StateRef`, `class StateRef`, `interface ServiceHub`, `class StaticPointer`, `interface ContractState`, `interface ContractState`, `resolve`, `exception TransactionResolutionException`

- - ### Constructor Detail

    - #### StaticPointer

          public StaticPointer(@NotNull
                               StateRef pointer,
                               @NotNull
                               java.lang.Class<T> type,
                               boolean isResolved)

      A `class StaticPointer` contains a pointer to a specific `class StateRef` and can be resolved by looking up the `class StateRef` via `interface ServiceHub`. There are a number of things to keep in mind when using `class StaticPointer`s:

      - The `interface ContractState` being pointed to may be spent or unspent when the pointer is resolved

      - The `interface ContractState` may not be known by the node performing the look-up in which case the `resolve` method will throw a `exception TransactionResolutionException`

      Parameters:
        `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.
      See Also:
        `class StaticPointer`, `class StateRef`, `class StateRef`, `interface ServiceHub`, `class StaticPointer`, `interface ContractState`, `interface ContractState`, `resolve`, `exception TransactionResolutionException`

    - #### StaticPointer

          public StaticPointer(@NotNull
                               StateRef pointer,
                               @NotNull
                               java.lang.Class<T> type)

      Allows this class to be evolved through backwards compatibility with version 1 of this class.

      Parameters:
        `pointer` - The state reference that this points to.
        `type` - The underlying `interface LinearState` type that this points to.

  - ### Method Detail

    - #### resolve

          @NotNull
          public StateAndRef<T> resolve(@NotNull
                                                 ServiceHub services)

      Resolves a `class StaticPointer` to a `class StateAndRef` via a `class StateRef` look-up.

      Parameters:
        `services` - a `interface ServiceHub` implementation is required to resolve the pointer.
      See Also:
        `class StaticPointer`, `class StateAndRef`, `class StateRef`

    - #### resolve

          @NotNull
          public StateAndRef<T> resolve(@NotNull
                                                 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.

      Parameters:
        `ltx` - the `class LedgerTransaction` containing the `pointer` and pointed-to states.
      See Also:
        `class StatePointer`, `class StateAndRef`, `class LedgerTransaction`

    - #### equals

          public boolean equals(@Nullable
                                java.lang.Object other)

    - #### hashCode

          public int hashCode()

    - #### getPointer

          @NotNull
          public StateRef getPointer()

      An identifier for the

      `interface ContractState` that this `class StatePointer` points to.

      See Also:
        `interface ContractState`, `class StatePointer`

    - #### getType

          @NotNull
          public java.lang.Class<T> getType()

      Type of the state which is being pointed to.

    - #### isResolved

          public boolean isResolved()

      Determines whether the state pointer should be resolved to a reference input when used in a transaction.