net.corda.core.contracts

## Class TransactionState<T extends ContractState>

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

-     public class TransactionState<T extends ContractState>

  A wrapper for `interface ContractState` containing additional platform-level state information. This is the definitive state that is stored on the ledger and used in transaction outputs.

  See Also:
    `interface ContractState`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TransactionState(T data, Party notary, java.lang.Integer encumbrance)` A wrapper for `interface ContractState` containing additional platform-level state information. This is the definitive state that is stored on the ledger and used in transaction outputs.
    `TransactionState(T data, Party notary)` A wrapper for `interface ContractState` containing additional platform-level state information. This is the definitive state that is stored on the ledger and used in transaction outputs.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `T` | `component1()` The custom contract state
    `Party` | `component2()` Identity of the notary that ensures the state is not used as an input to a transaction more than once
    `java.lang.Integer` | `component3()` All contract states may be encumbered by up to one other state.
    `TransactionState<T>` | `copy(T data, Party notary, java.lang.Integer encumbrance)` A wrapper for `interface ContractState` containing additional platform-level state information. This is the definitive state that is stored on the ledger and used in transaction outputs.
    `boolean` | `equals(java.lang.Object p)`
    `T` | `getData()` The custom contract state
    `java.lang.Integer` | `getEncumbrance()` All contract states may be encumbered by up to one other state.
    `Party` | `getNotary()` Identity of the notary that ensures the state is not used as an input to a transaction more than once
    `int` | `hashCode()`
    `java.lang.String` | `toString()`
    `TransactionState<T>` | `withNotary(Party newNotary)` Copies the underlying state, replacing the notary field with the new value. To replace the notary, we need an approval (signature) from all participants of the `interface ContractState`.

- - ### Constructor Detail

    - #### TransactionState

          public TransactionState(T data,
                                  Party notary,
                                  java.lang.Integer encumbrance)

      A wrapper for `interface ContractState` containing additional platform-level state information. This is the definitive state that is stored on the ledger and used in transaction outputs.

      Parameters:
        `data` - The custom contract state
        `notary` - Identity of the notary that ensures the state is not used as an input to a transaction more than once
        `encumbrance` -

        All contract states may be encumbered by up to one other state.

        The encumbrance state, if present, forces additional controls over the encumbered state, since the platform checks that the encumbrance state is present as an input in the same transaction that consumes the encumbered state, and the contract code and rules of the encumbrance state will also be verified during the execution of the transaction. For example, a cash contract state could be encumbered with a time-lock contract state; the cash state is then only processable in a transaction that verifies that the time specified in the encumbrance time-lock has passed.

        The encumbered state refers to another by index, and the referred encumbrance state is an output state in a particular position on the same transaction that created the encumbered state. An alternative implementation would be encumbering by reference to a `class StateRef`, which would allow the specification of encumbrance by a state created in a prior transaction.

        Note that an encumbered state that is being consumed must have its encumbrance consumed in the same transaction, otherwise the transaction is not valid.

      See Also:
        `interface ContractState`

    - #### TransactionState

          public TransactionState(T data,
                                  Party notary)

      A wrapper for `interface ContractState` containing additional platform-level state information. This is the definitive state that is stored on the ledger and used in transaction outputs.

      Parameters:
        `data` - The custom contract state
        `notary` - Identity of the notary that ensures the state is not used as an input to a transaction more than once
      See Also:
        `interface ContractState`

  - ### Method Detail

    - #### withNotary

          public TransactionState<T> withNotary(Party newNotary)

      Copies the underlying state, replacing the notary field with the new value. To replace the notary, we need an approval (signature) from all participants of the `interface ContractState`.

      See Also:
        `interface ContractState`

    - #### getData

          public T getData()

      The custom contract state

    - #### getNotary

          public Party getNotary()

      Identity of the notary that ensures the state is not used as an input to a transaction more than once

    - #### getEncumbrance

          public java.lang.Integer getEncumbrance()

      All contract states may be encumbered by up to one other state.

      The encumbrance state, if present, forces additional controls over the encumbered state, since the platform checks that the encumbrance state is present as an input in the same transaction that consumes the encumbered state, and the contract code and rules of the encumbrance state will also be verified during the execution of the transaction. For example, a cash contract state could be encumbered with a time-lock contract state; the cash state is then only processable in a transaction that verifies that the time specified in the encumbrance time-lock has passed.

      The encumbered state refers to another by index, and the referred encumbrance state is an output state in a particular position on the same transaction that created the encumbered state. An alternative implementation would be encumbering by reference to a `class StateRef`, which would allow the specification of encumbrance by a state created in a prior transaction.

      Note that an encumbered state that is being consumed must have its encumbrance consumed in the same transaction, otherwise the transaction is not valid.

      See Also:
        `class StateRef`

    - #### component1

          public T component1()

      The custom contract state

    - #### component2

          public Party component2()

      Identity of the notary that ensures the state is not used as an input to a transaction more than once

    - #### component3

          public java.lang.Integer component3()

      All contract states may be encumbered by up to one other state.

      The encumbrance state, if present, forces additional controls over the encumbered state, since the platform checks that the encumbrance state is present as an input in the same transaction that consumes the encumbered state, and the contract code and rules of the encumbrance state will also be verified during the execution of the transaction. For example, a cash contract state could be encumbered with a time-lock contract state; the cash state is then only processable in a transaction that verifies that the time specified in the encumbrance time-lock has passed.

      The encumbered state refers to another by index, and the referred encumbrance state is an output state in a particular position on the same transaction that created the encumbered state. An alternative implementation would be encumbering by reference to a `class StateRef`, which would allow the specification of encumbrance by a state created in a prior transaction.

      Note that an encumbered state that is being consumed must have its encumbrance consumed in the same transaction, otherwise the transaction is not valid.

      See Also:
        `class StateRef`

    - #### copy

          public TransactionState<T> copy(T data,
                                          Party notary,
                                          java.lang.Integer encumbrance)

      A wrapper for `interface ContractState` containing additional platform-level state information. This is the definitive state that is stored on the ledger and used in transaction outputs.

      See Also:
        `interface ContractState`

    - #### toString

          public java.lang.String toString()

    - #### hashCode

          public int hashCode()

    - #### equals

          public boolean equals(java.lang.Object p)