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

net.corda.core.contracts

## Class StateAndRef<T extends ContractState>

- net.corda.core.contracts.StateAndRef<T>

-     public class StateAndRef<T extends ContractState>

  A StateAndRef is simply a (state, ref) pair. For instance, a vault (which holds available assets) contains these.

- - ### Constructor Detail

    - #### StateAndRef

          public StateAndRef(@NotNull
                             TransactionState<? extends T> state,
                             @NotNull
                             StateRef ref)

      A StateAndRef is simply a (state, ref) pair. For instance, a vault (which holds available assets) contains these.

  - ### Method Detail

    - #### referenced

          @NotNull
          public ReferencedStateAndRef<T> referenced()

      For adding `class StateAndRef`s as references to a TransactionBuilder.

      See Also:
        `class StateAndRef`, TransactionBuilder

    - #### getState

          @NotNull
          public TransactionState<T> getState()

    - #### getRef

          @NotNull
          public StateRef getRef()

    - #### component1

          @NotNull
          public TransactionState<T> component1()

    - #### component2

          @NotNull
          public StateRef component2()

    - #### copy

          @NotNull
          public StateAndRef<T> copy(@NotNull
                                              TransactionState<? extends T> state,
                                              @NotNull
                                              StateRef ref)

      A StateAndRef is simply a (state, ref) pair. For instance, a vault (which holds available assets) contains these.

    - #### toString

          @NotNull
          public java.lang.String toString()

      A StateAndRef is simply a (state, ref) pair. For instance, a vault (which holds available assets) contains these.

    - #### hashCode

          public int hashCode()

      A StateAndRef is simply a (state, ref) pair. For instance, a vault (which holds available assets) contains these.

    - #### equals

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

      A StateAndRef is simply a (state, ref) pair. For instance, a vault (which holds available assets) contains these.