public abstract class StringBasedFunction
extends java.lang.Object
JacksonBasedFunction
in most cases, but you can use this class to
achieve faster and more efficient function execution by avoiding JSON serialization and
deserialization.Modifier and Type | Field and Description |
---|---|
protected T |
contractContext |
protected T |
contractProperties |
Constructor and Description |
---|
StringBasedFunction() |
Modifier and Type | Method and Description |
---|---|
protected T |
getContractContext()
Returns a contract context given from a contract that is executed together with the function.
|
protected T |
getContractProperties() |
abstract T |
invoke(Database<G,S,P,D,R> database,
T functionArgument,
T contractArgument,
T contractProperties)
Invokes the function to
Database with the specified argument and the corresponding root
contract argument and properties. |
protected T |
invoke(java.lang.String functionId,
Database<G,S,P,D,R> database,
T functionArgument,
T contractArgument) |
boolean |
isRoot() |
protected T contractProperties
protected T contractContext
@Nullable protected T getContractProperties()
public boolean isRoot()
@Nullable protected T getContractContext()
@Nullable public abstract T invoke(Database<G,S,P,D,R> database, @Nullable T functionArgument, T contractArgument, @Nullable T contractProperties)
Database
with the specified argument and the corresponding root
contract argument and properties. An implementation of the FunctionBase
should throw
ContractContextException
if it faces application-level contextual error (such as lack
of balance in payment application).database
- mutable databasefunctionArgument
- function argumentcontractArgument
- the argument of the corresponding root contractcontractProperties
- the pre-registered properties of the corresponding root contract@Nullable protected final T invoke(java.lang.String functionId, Database<G,S,P,D,R> database, @Nullable T functionArgument, T contractArgument)