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

net.corda.core.contracts

## Annotation Type BelongsToContract

-     @Target
       @Retention
       @Target
      public BelongsToContract

  This annotation is required by any `interface ContractState` which needs to ensure that it is only ever processed as part of a `class TransactionState` referencing the specified `interface Contract`. It may be omitted in the case that the `interface ContractState` class is defined as an inner class of its owning `interface Contract` class, in which case the "X belongs to Y" relationship is taken to be implicitly declared.

  During verification of transactions, prior to their being written into the ledger, all input and output states are checked to ensure that their `interface ContractState`s match with their `interface Contract`s as specified either by this annotation, or by their inner/outer class relationship.

  The transaction will write a warning to the log (for corDapps with a target version less than 4) or fail with a `exception TransactionVerificationException.TransactionContractConflictException` if any mismatch is detected.

  See Also:
    `interface ContractState`, `class TransactionState`, `interface Contract`, `interface ContractState`, `interface Contract`, `interface ContractState`, `interface Contract`, `exception TransactionVerificationException.TransactionContractConflictException`