Obligation.State
Keywords: net.corda.finance.contracts.asset.Obligation.State class
Date: 2023-09-18

net.corda.finance.contracts.asset

## Class Obligation.State<P>

- net.corda.finance.contracts.asset.Obligation.State<P>

- Type Parameters:
    `P` -

    the product the obligation is for payment of.

  All Implemented Interfaces:
    BilateralNettableState<N>, ContractState, FungibleAsset<T>, FungibleState<T>, MultilateralNettableState<T>, NettableState<N,T>, OwnableState
  Enclosing class:
    Obligation<P>

      public static class Obligation.State<P>
      implements FungibleAsset<T>, NettableState<N,T>

  A state representing the obligation of one party (obligor) to deliver a specified number of units of an underlying asset (described as token.acceptableIssuedProducts) to the beneficiary no later than the specified time.

- - ### Constructor Detail

    - #### State

          public State(@NotNull
                       net.corda.finance.contracts.asset.Obligation.Lifecycle lifecycle,
                       @NotNull
                       AbstractParty obligor,
                       @NotNull
                       net.corda.finance.contracts.asset.Obligation.Terms<P> template,
                       long quantity,
                       @NotNull
                       AbstractParty beneficiary)

      A state representing the obligation of one party (obligor) to deliver a specified number of units of an underlying asset (described as token.acceptableIssuedProducts) to the beneficiary no later than the specified time.

      Parameters:
        `obligor` - Where the debt originates from (obligor)
        `beneficiary` - The public key of the entity the contract pays to

  - ### Method Detail

    - #### getAmount

          @NotNull
          public Amount<net.corda.core.contracts.Issued> getAmount()

      Amount represents a positive quantity of some issued product which can be cash, tokens, assets, or generally anything else that's quantifiable with integer quantities. See `class Issued` and `class Amount` for more details.

      See Also:
        `class Issued`, `class Amount`

    - #### getExitKeys

          @NotNull
          public java.util.Collection<java.security.PublicKey> getExitKeys()

      There must be an ExitCommand signed by these keys to destroy the amount. While all states require their owner to sign, some (i.e. cash) also require the issuer.

    - #### getDueBefore

          @NotNull
          public java.time.Instant getDueBefore()

    - #### getParticipants

          @NotNull
          public java.util.List<net.corda.core.identity.AbstractParty> getParticipants()

    - #### getOwner

          @NotNull
          public AbstractParty getOwner()

      There must be a MoveCommand signed by this key to claim the amount.

    - #### withNewOwnerAndAmount

          @NotNull
          public net.corda.finance.contracts.asset.Obligation.State<P> withNewOwnerAndAmount(@NotNull
                                                                                                      Amount<net.corda.core.contracts.Issued> newAmount,
                                                                                                      @NotNull
                                                                                                      AbstractParty newOwner)

      Copies the underlying data structure, replacing the amount and owner fields with the new values and leaving the rest (exitKeys) alone.

    - #### toString

          @NotNull
          public java.lang.String toString()

    - #### getBilateralNetState

          @NotNull
          public BilateralNetState<P> getBilateralNetState()

      Returns an object used to determine if two states can be subject to close-out netting. If two states return equal objects, they can be close out netted together.

    - #### getMultilateralNetState

          @NotNull
          public MultilateralNetState<P> getMultilateralNetState()

      Returns an object used to determine if two states can be subject to close-out netting. If two states return equal objects, they can be close out netted together.

    - #### net

          @NotNull
          public net.corda.finance.contracts.asset.Obligation.State<P> net(@NotNull
                                                                                    net.corda.finance.contracts.asset.Obligation.State<P> other)

      Perform bilateral netting of this state with another state. The two states must be compatible (as in bilateralNetState objects are equal).

    - #### withNewOwner

          @NotNull
          public CommandAndState withNewOwner(@NotNull
                                                       AbstractParty newOwner)

      Copies the underlying data structure, replacing the owner field with this new value and leaving the rest alone.

    - #### getLifecycle

          @NotNull
          public net.corda.finance.contracts.asset.Obligation.Lifecycle getLifecycle()

    - #### setLifecycle

          public void setLifecycle(@NotNull
                                   net.corda.finance.contracts.asset.Obligation.Lifecycle p)

    - #### getObligor

          @NotNull
          public AbstractParty getObligor()

      Where the debt originates from

      (obligor)

    - #### getTemplate

          @NotNull
          public net.corda.finance.contracts.asset.Obligation.Terms<P> getTemplate()

    - #### getQuantity

          public long getQuantity()

    - #### getBeneficiary

          @NotNull
          public AbstractParty getBeneficiary()

      The public key of the entity the contract pays to

    - #### component1

          @NotNull
          public net.corda.finance.contracts.asset.Obligation.Lifecycle component1()

    - #### component2

          @NotNull
          public AbstractParty component2()

      Where the debt originates from

      (obligor)

    - #### component3

          @NotNull
          public net.corda.finance.contracts.asset.Obligation.Terms<P> component3()

    - #### component4

          public long component4()

    - #### component5

          @NotNull
          public AbstractParty component5()

      The public key of the entity the contract pays to

    - #### copy

          @NotNull
          public net.corda.finance.contracts.asset.Obligation.State<P> copy(@NotNull
                                                                                     net.corda.finance.contracts.asset.Obligation.Lifecycle lifecycle,
                                                                                     @NotNull
                                                                                     AbstractParty obligor,
                                                                                     @NotNull
                                                                                     net.corda.finance.contracts.asset.Obligation.Terms<P> template,
                                                                                     long quantity,
                                                                                     @NotNull
                                                                                     AbstractParty beneficiary)

      A state representing the obligation of one party (obligor) to deliver a specified number of units of an underlying asset (described as token.acceptableIssuedProducts) to the beneficiary no later than the specified time.

    - #### hashCode

          public int hashCode()

      A state representing the obligation of one party (obligor) to deliver a specified number of units of an underlying asset (described as token.acceptableIssuedProducts) to the beneficiary no later than the specified time.

    - #### equals

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

      A state representing the obligation of one party (obligor) to deliver a specified number of units of an underlying asset (described as token.acceptableIssuedProducts) to the beneficiary no later than the specified time.