Interface RealizedExpression

All Superinterfaces:
AutoCloseable

public interface RealizedExpression extends AutoCloseable

Represents an Expression that has been realized against a specific RiskScape type. Given an object that conforms to that type, this expression can be safely evaluated against it.

  • Field Details

  • Method Details

    • getInputType

      Type getInputType()
      Returns:
      the type that this expression was realized for
    • getResultType

      Type getResultType()
      Returns:
      the type that this expression yields
    • evaluate

      Object evaluate(Object input)

      Evaluate this expression against the given object

      Parameters:
      input - an object that must conform to getInputType()
      Returns:
      an object that must conform to getResultType()
    • evaluateValues

      default Object evaluateValues(Object... values)

      Convenience form of evaluate(java.lang.Object) for expressions that you know accept a Struct input type.

      This method will return evaluate(Tuple.ofValues(getInputType().asStruct(), values)

    • getExpression

      Expression getExpression()
      Returns:
      the AST that this expression was realized from.
    • getDependencies

      List<RealizedExpression> getDependencies()
      Returns:
      any RealizedExpressions that are inputs in to this realized expression
    • close

      default void close()

      Destroy/release/abandon any resources associated with this expression. Note that a realized expression should propagate closing to any dependencies, as the default implementation does.

      See Javadoc Realized for more discussion on the life-cycle of executable objects like these.

      Specified by:
      close in interface AutoCloseable