findOutRef

fun <T : ContractState> findOutRef(clazz: Class<T>, predicate: Predicate<T>): StateAndRef<T>

Helper to simplify finding a single output StateAndRef matching a Predicate.

Return

the single StateAndRef item matching the predicate.

Parameters

clazz

The class type used for filtering via an Class.isInstance check. Clazz must be an extension of ContractState.

predicate

A filtering function taking a state of type T and returning true if this is the desired item. The class filtering is applied before the predicate.

Throws

if no item, or multiple items are found matching the requirements.


inline fun <T : ContractState> findOutRef(crossinline predicate: (T) -> Boolean): StateAndRef<T>