@DoNotImplement public class BaseTransaction implements NamedByHash
An abstract class defining fields shared by all transaction types in the system.
public BaseTransaction()
An abstract class defining fields shared by all transaction types in the system.
@NotNull public java.util.List<?> getReferences()
A list of reusable reference data states which can be referred to by other contracts in this transaction.
@NotNull public java.util.List<?> getInputs()
The inputs of this transaction. Note that in BaseTransaction subclasses the type of this list may change!
@NotNull public java.util.List<net.corda.core.contracts.TransactionState> getOutputs()
Ordered list of states defined by this transaction, along with the associated notaries.
@Nullable public Party getNotary()
If present, the notary for this transaction. If absent then the transaction is not notarised at all. This is intended for issuance/genesis transactions that don't consume any other states and thus can't double spend anything.
protected void checkBaseInvariants()
@NotNull public <T extends ContractState> StateAndRef<T> outRef(int index)
Returns a class StateAndRef
for the given output index.
class StateAndRef
@NotNull public <T extends ContractState> StateAndRef<T> outRef(@NotNull ContractState state)
Returns a class StateAndRef
for the requested output state, or throws IllegalArgumentException if not found.
class StateAndRef
,
IllegalArgumentException@NotNull public java.util.List<net.corda.core.contracts.ContractState> getOutputStates()
Helper property to return a list of interface ContractState
objects, rather than the often less convenient class TransactionState
interface ContractState
,
class TransactionState
@NotNull public ContractState getOutput(int index)
Helper to simplify getting an indexed output.
index
- the position of the item in the output.@NotNull public <T extends ContractState> java.util.List<T> outputsOfType(@NotNull java.lang.Class<T> clazz)
Helper to simplify getting all output states of a particular class, interface, or base class.
clazz
- The class type used for filtering via an Class.isInstance check.Clazz must be an extension of interface ContractState
.@NotNull public <T extends ContractState> java.util.List<T> filterOutputs(@NotNull java.lang.Class<T> clazz, @NotNull java.util.function.Predicate<T> predicate)
Helper to simplify filtering outputs according to a Predicate.
clazz
- The class type used for filtering via an Class.isInstance check.Clazz must be an extension of interface ContractState
.predicate
- A filtering function taking a state of type T and returning true if it should be included in the list.The class filtering is applied before the predicate.@NotNull public <T extends ContractState> T findOutput(@NotNull java.lang.Class<T> clazz, @NotNull java.util.function.Predicate<T> predicate)
Helper to simplify finding a single output matching a Predicate.
clazz
- The class type used for filtering via an Class.isInstance check.Clazz must be an extension of interface 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.IllegalArgumentException
- if no item, or multiple items are found matching the requirements.@NotNull public <T extends ContractState> java.util.List<net.corda.core.contracts.StateAndRef> outRefsOfType(@NotNull java.lang.Class<T> clazz)
Helper to simplify getting all output class StateAndRef
items of a particular state class, interface, or base class.
clazz
- The class type used for filtering via an Class.isInstance check.Clazz must be an extension of interface ContractState
.class StateAndRef
states matching the clazz restriction.class StateAndRef
@NotNull public <T extends ContractState> java.util.List<net.corda.core.contracts.StateAndRef> filterOutRefs(@NotNull java.lang.Class<T> clazz, @NotNull java.util.function.Predicate<T> predicate)
Helper to simplify filtering output class StateAndRef
items according to a Predicate.
clazz
- The class type used for filtering via an Class.isInstance check.Clazz must be an extension of interface ContractState
.predicate
- A filtering function taking a state of type T and returning true if it should be included in the list.The class filtering is applied before the predicate.class StateAndRef
states matching the predicate and clazz restrictions.class StateAndRef
,
Predicate@NotNull public <T extends ContractState> StateAndRef<T> findOutRef(@NotNull java.lang.Class<T> clazz, @NotNull java.util.function.Predicate<T> predicate)
Helper to simplify finding a single output class StateAndRef
matching a Predicate.
clazz
- The class type used for filtering via an Class.isInstance check.Clazz must be an extension of interface 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.class StateAndRef
item matching the predicate.IllegalArgumentException
- if no item, or multiple items are found matching the requirements.class StateAndRef
,
Predicate@NotNull public java.lang.String toString()