public abstract class StringBasedContract
extends java.lang.Object
JacksonBasedContract
in most cases, but you can use this class to
achieve faster and more efficient contract execution by avoiding JSON serialization and
deserialization.Constructor and Description |
---|
StringBasedContract() |
Modifier and Type | Method and Description |
---|---|
CertificateEntry.Key |
getCertificateKey()
Deprecated.
|
ClientIdentityKey |
getClientIdentityKey() |
abstract T |
invoke(Ledger<T> ledger,
T argument,
T properties)
Invokes the contract to
Ledger with the specified argument and the pre-registered
contract properties. |
protected T |
invoke(java.lang.String contractId,
Ledger<T> ledger,
T argument)
Invokes the specified contract to
Ledger with the specified argument. |
boolean |
isRoot() |
protected void |
setContext(T context)
Sets a contract runtime context to pass it to functions.
|
public boolean isRoot()
@Deprecated public CertificateEntry.Key getCertificateKey()
CertificateEntry.Key
, but it returns the entity ID and key version of a certificate or HMAC
secret key tied to the contract.public ClientIdentityKey getClientIdentityKey()
protected void setContext(@Nullable T context)
context
- a contract runtime context@Nullable public abstract T invoke(Ledger<T> ledger, T argument, @Nullable T properties)
Ledger
with the specified argument and the pre-registered
contract properties. An implementation of the ContractBase
should throw ContractContextException
if it faces application-level contextual error (such as lack of
balance in payment application).ledger
- tamper-evident ledgerargument
- contract argumentproperties
- pre-registered contract properties@Nullable protected T invoke(java.lang.String contractId, Ledger<T> ledger, T argument)
Ledger
with the specified argument.contractId
- another contract ID to invokeledger
- tamper-evident ledgerargument
- contract argument