Class CalledContext

java.lang.Object
dev.metaschema.core.metapath.function.CalledContext

public final class CalledContext extends Object
Represents an immutable execution context for function calls in Metapath expressions.

This class is designed to support both named and anonymous functions by maintaining the function instance, its arguments, and the current context item. It ensures thread-safety through immutability and is primarily used during the evaluation of Metapath expressions and for caching the function results.

  • Constructor Details

    • CalledContext

      public CalledContext(@NonNull IFunction function, @NonNull List<ISequence<?>> arguments, @Nullable IItem contextItem)
      Creates an immutable execution context for a function call.
      Parameters:
      function - the function to be executed
      arguments - the list of evaluated arguments as sequences, must match function's arity
      contextItem - the optional context item representing the current node in scope
  • Method Details

    • getFunction

      @NonNull public IFunction getFunction()
      Get the function instance associated with the calling context.
      Returns:
      the function instance
    • getContextItem

      @Nullable public IItem getContextItem()
      Get the node item focus associated with the calling context.
      Returns:
      the context item, or null if no context is set
    • getArguments

      @NonNull public List<ISequence<?>> getArguments()
      Get the arguments associated with the calling context.
      Returns:
      the arguments
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object