com.r3corda.core.contracts.clauses / Clause

Clause

interface Clause<in S : ContractState, C : CommandData, in K : Any>

Parameters

S - the type of contract state this clause operates on.

C - a common supertype of commands this clause operates on.

K - the type of the grouping key for states this clause operates on. Use Unit if not applicable.


Properties

requiredCommands abstract val requiredCommands: Set<Class<out CommandData>>

Determine whether this clause runs or not

Functions

getExecutionPath abstract fun getExecutionPath(commands: List<AuthenticatedObject<C>>): List<Clause<*, *, *>>

Determine the subclauses which will be verified as a result of verifying this clause.

verify abstract fun verify(tx: TransactionForContract, inputs: List<S>, outputs: List<S>, commands: List<AuthenticatedObject<C>>, groupingKey: K?): Set<C>

Verify the transaction matches the conditions from this clause. For example, a "no zero amount output" clause would check each of the output states that it applies to, looking for a zero amount, and throw IllegalStateException if any matched.

Companion Object Properties

log val log: <ERROR CLASS>

Extension Functions

matches fun <C : CommandData> Clause<*, C, *>.matches(commands: List<AuthenticatedObject<C>>): Boolean

Determine if the given list of commands matches the required commands for a clause to trigger.

Inheritors

CompositeClause abstract class CompositeClause<in S : ContractState, C : CommandData, in K : Any> : Clause<S, C, K>

Abstract supertype for clauses which compose other clauses together in some logical manner.

ConcreteClause abstract class ConcreteClause<in S : ContractState, C : CommandData, in T : Any> : Clause<S, C, T>

Abstract supertype for clauses which provide their own verification logic, rather than delegating to subclauses. By default these clauses are always matched (they have no required commands).