From dd9a653ab48ca18e552bb3f387a5be9c0a5a5ffd Mon Sep 17 00:00:00 2001 From: Andrius Dagys Date: Wed, 29 Jun 2016 16:32:29 +0100 Subject: [PATCH] TransactionBuilder: added a comment explaining the default notary parameter purpose --- .../kotlin/com/r3corda/core/contracts/TransactionBuilder.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/src/main/kotlin/com/r3corda/core/contracts/TransactionBuilder.kt b/core/src/main/kotlin/com/r3corda/core/contracts/TransactionBuilder.kt index b66803898f..0d80a1cc92 100644 --- a/core/src/main/kotlin/com/r3corda/core/contracts/TransactionBuilder.kt +++ b/core/src/main/kotlin/com/r3corda/core/contracts/TransactionBuilder.kt @@ -15,6 +15,10 @@ import java.util.* * * The builder can be customised for specific transaction types, e.g. where additional processing is needed * before adding a state/command. + * + * @param notary The default notary that will be used for outputs that don't have a notary specified. When this is set, + * an output state can be added by just passing in a [ContractState] – a [TransactionState] with the + * default notary will be generated automatically. */ abstract class TransactionBuilder(protected val type: TransactionType = TransactionType.General(), protected val notary: Party? = null) { @@ -129,6 +133,7 @@ abstract class TransactionBuilder(protected val type: TransactionType = Transact fun addOutputState(state: ContractState, notary: Party) = addOutputState(TransactionState(state, notary)) + /** A default notary must be specified during builder construction to use this method */ fun addOutputState(state: ContractState) { checkNotNull(notary) { "Need to specify a Notary for the state, or set a default one on TransactionBuilder initialisation" } addOutputState(state, notary!!)