mirror of
https://github.com/corda/corda.git
synced 2025-01-18 18:56:28 +00:00
TransactionBuilder: added a comment explaining the default notary parameter purpose
This commit is contained in:
parent
d29dd121ff
commit
dd9a653ab4
@ -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!!)
|
||||
|
Loading…
Reference in New Issue
Block a user