Class CoercingFunctionWrapper

java.lang.Object
nz.org.riskscape.engine.CoercingFunctionWrapper
All Implemented Interfaces:
AutoCloseable, nz.org.riskscape.engine.function.RiskscapeFunction, nz.org.riskscape.engine.function.UntypedFunction

public class CoercingFunctionWrapper extends Object implements nz.org.riskscape.engine.function.RiskscapeFunction
  • Field Summary

    Fields inherited from interface nz.org.riskscape.engine.function.RiskscapeFunction

    BUILT_IN
  • Method Summary

    Modifier and Type
    Method
    Description
    call(List<Object> args)
     
    void
     
    List<nz.org.riskscape.engine.types.Type>
     
    List<Optional<nz.org.riskscape.engine.types.eqrule.Coercer>>
     
    nz.org.riskscape.engine.types.Type
     
    nz.org.riskscape.engine.function.RiskscapeFunction
     
     
    static nz.org.riskscape.engine.function.RiskscapeFunction
    wrap(nz.org.riskscape.engine.function.RiskscapeFunction wrapped, List<Optional<nz.org.riskscape.engine.types.eqrule.Coercer>> coercers)
    Return a RiskscapeFunction that wraps another function to apply any Coercers to the input arguments before passing them to the wrapped function.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface nz.org.riskscape.engine.function.RiskscapeFunction

    builtin, getAggregationFunction, getArguments, getOverloaded, getRealizable, getTypesFromArguments, identified, identified, isA, setProblemReporter, validate
  • Method Details

    • wrap

      public static nz.org.riskscape.engine.function.RiskscapeFunction wrap(nz.org.riskscape.engine.function.RiskscapeFunction wrapped, List<Optional<nz.org.riskscape.engine.types.eqrule.Coercer>> coercers)

      Return a RiskscapeFunction that wraps another function to apply any Coercers to the input arguments before passing them to the wrapped function. This function advertises argument types based on the coercer's source type, falling back to the wrapped function's original advertised type if no coercer was present for that argument.

    • call

      public Object call(List<Object> args)
      Specified by:
      call in interface nz.org.riskscape.engine.function.UntypedFunction
    • getReturnType

      public nz.org.riskscape.engine.types.Type getReturnType()
      Specified by:
      getReturnType in interface nz.org.riskscape.engine.function.RiskscapeFunction
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface nz.org.riskscape.engine.function.UntypedFunction
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getCoercers

      public List<Optional<nz.org.riskscape.engine.types.eqrule.Coercer>> getCoercers()
    • getWrapped

      public nz.org.riskscape.engine.function.RiskscapeFunction getWrapped()
    • getArgumentTypes

      public List<nz.org.riskscape.engine.types.Type> getArgumentTypes()
      Specified by:
      getArgumentTypes in interface nz.org.riskscape.engine.function.RiskscapeFunction