BelongsToContract - corda

corda / net.corda.core.contracts / BelongsToContract

# BelongsToContract

`@Target([AnnotationTarget.CLASS]) annotation class BelongsToContract`

This annotation is required by any ContractState which needs to ensure that it is only ever processed as part of a TransactionState referencing the specified Contract. It may be omitted in the case that the ContractState class is defined as an inner class of its owning 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 ContractStates match with their Contracts 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 TransactionContractConflictException if any mismatch is detected.

### Parameters

`value` - The class of the Contract to which states of the annotated ContractState belong.

### Constructors

#### <init> | This annotation is required by any ContractState which needs to ensure that it is only ever processed as part of a TransactionState referencing the specified Contract. It may be omitted in the case that the ContractState class is defined as an inner class of its owning Contract class, in which case the "X belongs to Y" relationship is taken to be implicitly declared. `BelongsToContract(value: KClass<out Contract>)`

### Properties

#### value | The class of the Contract to which states of the annotated ContractState belong. `val value: KClass<out Contract>`