public class BaseTransaction implements NamedByHash
An abstract class defining fields shared by all transaction types in the system.
Constructor and Description |
---|
BaseTransaction()
An abstract class defining fields shared by all transaction types in the system.
|
Modifier and Type | Method and Description |
---|---|
void |
checkBaseInvariants() |
<T extends ContractState> |
filterOutRefs(java.lang.Class<T> clazz,
java.util.function.Predicate<T> predicate)
Helper to simplify filtering output
class StateAndRef items according to a Predicate. |
<T extends ContractState> |
filterOutputs(java.lang.Class<T> clazz,
java.util.function.Predicate<T> predicate)
Helper to simplify filtering outputs according to a Predicate.
|
<T extends ContractState> |
findOutRef(java.lang.Class<T> clazz,
java.util.function.Predicate<T> predicate)
Helper to simplify finding a single output
class StateAndRef matching a Predicate. |
<T extends ContractState> |
findOutput(java.lang.Class<T> clazz,
java.util.function.Predicate<T> predicate)
Helper to simplify finding a single output matching a Predicate.
|
java.util.List<?> |
getInputs()
The inputs of this transaction. Note that in BaseTransaction subclasses the type of this list may change!
|
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.
|
ContractState |
getOutput(int index)
Helper to simplify getting an indexed output.
|
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 |
java.util.List<net.corda.core.contracts.TransactionState> |
getOutputs()
Ordered list of states defined by this transaction, along with the associated notaries.
|
java.util.List<?> |
getReferences()
A list of reusable reference data states which can be referred to by other contracts in this transaction.
|
<T extends ContractState> |
outRef(int index)
Returns a
class StateAndRef for the given output index. |
<T extends ContractState> |
outRef(ContractState state)
Returns a
class StateAndRef for the requested output state, or throws IllegalArgumentException if not found. |
<T extends ContractState> |
outRefsOfType(java.lang.Class<T> clazz)
Helper to simplify getting all output
class StateAndRef items of a particular state class, interface, or base class. |
<T extends ContractState> |
outputsOfType(java.lang.Class<T> clazz)
Helper to simplify getting all output states of a particular class, interface, or base class.
|
java.lang.String |
toString() |
getId
public BaseTransaction()
An abstract class defining fields shared by all transaction types in the system.
public java.util.List<?> getReferences()
A list of reusable reference data states which can be referred to by other contracts in this transaction.
public java.util.List<?> getInputs()
The inputs of this transaction. Note that in BaseTransaction subclasses the type of this list may change!
public java.util.List<net.corda.core.contracts.TransactionState> getOutputs()
Ordered list of states defined by this transaction, along with the associated notaries.
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.
public void checkBaseInvariants()
public <T extends ContractState> StateAndRef<T> outRef(int index)
Returns a class StateAndRef
for the given output index.
class StateAndRef
public <T extends ContractState> StateAndRef<T> outRef(ContractState state)
Returns a class StateAndRef
for the requested output state, or throws IllegalArgumentException if not found.
class StateAndRef
,
IllegalArgumentExceptionpublic 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
public ContractState getOutput(int index)
Helper to simplify getting an indexed output.
index
- the position of the item in the output.public <T extends ContractState> java.util.List<T> outputsOfType(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
.public <T extends ContractState> java.util.List<T> filterOutputs(java.lang.Class<T> clazz, 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.public <T extends ContractState> T findOutput(java.lang.Class<T> clazz, 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.public <T extends ContractState> java.util.List<net.corda.core.contracts.StateAndRef> outRefsOfType(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
public <T extends ContractState> java.util.List<net.corda.core.contracts.StateAndRef> filterOutRefs(java.lang.Class<T> clazz, 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
,
Predicatepublic <T extends ContractState> StateAndRef<T> findOutRef(java.lang.Class<T> clazz, 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.class StateAndRef
,
Predicatepublic java.lang.String toString()