Class JavaFunction<T>

java.lang.Object
team.unnamed.mocha.runtime.binding.JavaFunction<T>
All Implemented Interfaces:
Function<T>, Value

@Internal public final class JavaFunction<T> extends Object implements Function<T>
  • Method Details

    • object

      @Nullable public @Nullable Object object()
    • method

      @Nullable public @Nullable Method method()
    • evaluate

      @Nullable public @Nullable Value evaluate(@NotNull @NotNull ExecutionContext<T> context, @NotNull @NotNull Function.Arguments arguments)
      Description copied from interface: Function
      Executes this function with the given arguments.
      Specified by:
      evaluate in interface Function<T>
      Parameters:
      context - The execution context
      arguments - The arguments
      Returns:
      The function result
    • pure

      public boolean pure()
      Description copied from interface: Function
      Determines if this function is pure or not.

      A pure function is a function that has the following properties:

      1. The function return values are identical for identical arguments, and
      2. The function has no side effects

      The compiler or interpreter may pre-evaluate these functions ahead of time. In case of compiling, the function may be called during compile time, to use the function's result instead.

      Specified by:
      pure in interface Function<T>
      Returns:
      If this function is pure or not.