Class InterpreterBase.CallDispatcher

  • Enclosing class:
    InterpreterBase

    protected class InterpreterBase.CallDispatcher
    extends java.lang.Object
    Helping dispatch function calls.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) java.lang.Object[] argv
      The actual arguments.
      (package private) boolean cacheable
      Whether solution is cacheable.
      (package private) InterpreterBase.Funcall funcall
      The cacheable funcall if any.
      (package private) boolean narrow
      Whether arguments have been narrowed.
      (package private) JexlNode node
      The syntactic node.
      (package private) java.lang.Object target
      The method invocation target.
      (package private) JexlMethod vm
      The method to call.
    • Constructor Summary

      Constructors 
      Constructor Description
      CallDispatcher​(JexlNode anode, boolean acacheable)
      Dispatcher ctor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.Object eval​(java.lang.String methodName)
      Evaluates the method previously dispatched.
      protected boolean isArithmeticMethod​(java.lang.String methodName, java.lang.Object[] arguments)
      Whether the method is an arithmetic method.
      protected boolean isContextMethod​(java.lang.String methodName, java.lang.Object[] arguments)
      Whether the method is a context method.
      protected boolean isTargetMethod​(java.lang.Object ntarget, java.lang.String methodName, java.lang.Object[] arguments)
      Whether the method is a target method.
      protected java.lang.Object tryEval​(java.lang.Object ntarget, java.lang.String methodName, java.lang.Object[] arguments)
      Attempt to reuse last funcall cached in volatile JexlNode.value (if it was cacheable).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • node

        final JexlNode node
        The syntactic node.
      • cacheable

        final boolean cacheable
        Whether solution is cacheable.
      • narrow

        boolean narrow
        Whether arguments have been narrowed.
      • target

        java.lang.Object target
        The method invocation target.
      • argv

        java.lang.Object[] argv
        The actual arguments.
    • Constructor Detail

      • CallDispatcher

        CallDispatcher​(JexlNode anode,
                       boolean acacheable)
        Dispatcher ctor.
        Parameters:
        anode - the syntactic node.
        acacheable - whether resolution can be cached
    • Method Detail

      • eval

        protected java.lang.Object eval​(java.lang.String methodName)
                                 throws java.lang.Exception
        Evaluates the method previously dispatched.
        Parameters:
        methodName - the method name
        Returns:
        the method invocation result
        Throws:
        java.lang.Exception - when invocation fails
      • isArithmeticMethod

        protected boolean isArithmeticMethod​(java.lang.String methodName,
                                             java.lang.Object[] arguments)
        Whether the method is an arithmetic method.
        Parameters:
        methodName - the method name
        arguments - the method arguments
        Returns:
        true if arithmetic, false otherwise
      • isContextMethod

        protected boolean isContextMethod​(java.lang.String methodName,
                                          java.lang.Object[] arguments)
        Whether the method is a context method.
        Parameters:
        methodName - the method name
        arguments - the method arguments
        Returns:
        true if arithmetic, false otherwise
      • isTargetMethod

        protected boolean isTargetMethod​(java.lang.Object ntarget,
                                         java.lang.String methodName,
                                         java.lang.Object[] arguments)
        Whether the method is a target method.
        Parameters:
        ntarget - the target instance
        methodName - the method name
        arguments - the method arguments
        Returns:
        true if arithmetic, false otherwise
      • tryEval

        protected java.lang.Object tryEval​(java.lang.Object ntarget,
                                           java.lang.String methodName,
                                           java.lang.Object[] arguments)
        Attempt to reuse last funcall cached in volatile JexlNode.value (if it was cacheable).
        Parameters:
        ntarget - the target instance
        methodName - the method name
        arguments - the method arguments
        Returns:
        TRY_FAILED if invocation was not possible or failed, the result otherwise