All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.scalar.dl.ledger.function.StringBasedFunction Maven / Gradle / Ivy

There is a newer version: 3.10.0
Show newest version
package com.scalar.dl.ledger.function;

import com.scalar.db.api.Delete;
import com.scalar.db.api.Get;
import com.scalar.db.api.Put;
import com.scalar.db.api.Result;
import com.scalar.db.api.Scan;
import com.scalar.dl.ledger.database.Database;
import javax.annotation.Nullable;

/**
 * A base function using the internal String representation as it is for the invoke method
 * arguments, and invoke method return type. You can create your functions based on it. It is
 * recommended to use {@link JacksonBasedFunction} in most cases, but you can use this class to
 * achieve faster and more efficient function execution by avoiding JSON serialization and
 * deserialization.
 *
 * @author Hiroyuki Yamada
 */
public abstract class StringBasedFunction
    extends FunctionBase {

  @Override
  final void setContractProperties(@Nullable String contractProperties) {
    this.contractProperties = contractProperties;
  }

  @Override
  @Nullable
  final String invokeRoot(
      Database database,
      @Nullable String functionArgument,
      String contractArgument) {
    return invoke(database, functionArgument, contractArgument, getContractProperties());
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy