Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.jexl3.internal
Class InterpreterBase

    java.lang.Object
      org.apache.commons.jexl3.parser.ParserVisitor
          org.apache.commons.jexl3.internal.InterpreterBase

Direct Known Subclasses:
  Interpreter

    public abstract class InterpreterBase

extends ParserVisitor

The helper base of an interpreter of JEXL syntax.

Since:
  3.0

Field Summary
`protected JexlArithmetic` | `arithmetic` The arithmetic handler.
`protected static Class<?>` | `AUTOCLOSEABLE` Java7 AutoCloseable interface defined?.
`protected boolean` | `cancelled` Cancellation support.
`protected JexlContext` | `context` The context to store/retrieve variables.
`protected static Object[]` | `EMPTY_PARAMS` Empty parameters for method matching.
`protected Engine` | `jexl` The JEXL engine.
`protected org.apache.commons.logging.Log` | `logger` The logger.
`protected JexlUberspect` | `uberspect` The uberspect.

Constructor Summary
`protected` | `InterpreterBase(Engine engine, JexlContext aContext)` Creates an interpreter base.
`protected` | `InterpreterBase(InterpreterBase ii, JexlArithmetic jexla)` Copy constructor.

Method Summary
`protected Object` | `annotationError(JexlNode node, String annotation, Throwable cause)` Triggered when an annotation processing fails.
`protected boolean` | `cancel()` Cancels this evaluation, setting the cancel flag that will result in a JexlException.Cancel to be thrown.
`protected void` | `closeIfSupported(Object closeable)` Attempt to call close() if supported.
`protected JexlNode` | `findNullOperand(RuntimeException xrt, JexlNode node, Object left, Object right)` Finds the node causing a NPE for diadic operators.
`protected JexlException` | `invocationException(JexlNode node, String methodName, Exception xany)` Triggered when method, function or constructor invocation fails with an exception.
`protected boolean` | `isCancellable()`
`protected boolean` | `isCancelled()` Checks whether this interpreter execution was cancelled due to thread interruption.
`protected boolean` | `isSilent()` Whether this interpreter is currently evaluating with a silent mode.
`protected boolean` | `isStrictEngine()` Whether this interpreter is currently evaluating with a strict engine flag.
`protected Object` | `operatorError(JexlNode node, JexlOperator operator, Throwable cause)` Triggered when an operator fails.
`protected Object` | `unsolvableMethod(JexlNode node, String method)` Triggered when a method can not be resolved.
`protected Object` | `unsolvableProperty(JexlNode node, String var, Throwable cause)` Triggered when a property can not be resolved.
`protected Object` | `unsolvableVariable(JexlNode node, String var, boolean undef)` Triggered when a variable can not be resolved.

Methods inherited from class org.apache.commons.jexl3.parser.ParserVisitor
`visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### jexl

    protected final Engine jexl

  The JEXL engine.

### logger

    protected final org.apache.commons.logging.Log logger

  The logger.

### uberspect

    protected final JexlUberspect uberspect

  The uberspect.

### arithmetic

    protected final JexlArithmetic arithmetic

  The arithmetic handler.

### context

    protected final JexlContext context

  The context to store/retrieve variables.

### cancelled

    protected volatile boolean cancelled

  Cancellation support.

### EMPTY_PARAMS

    protected static final Object[] EMPTY_PARAMS

  Empty parameters for method matching.

### AUTOCLOSEABLE

    protected static final Class<?> AUTOCLOSEABLE

  Java7 AutoCloseable interface defined?.

Constructor Detail

### InterpreterBase

    protected InterpreterBase(Engine engine,
                              JexlContext aContext)

  Creates an interpreter base.

  Parameters:
    `engine` - the engine creating this interpreter
    `aContext` - the context to evaluate expression

### InterpreterBase

    protected InterpreterBase(InterpreterBase ii,
                              JexlArithmetic jexla)

  Copy constructor.

  Parameters:
    `ii` - the base to copy
    `jexla` - the arithmetic instance to use (or null)

Method Detail

### closeIfSupported

    protected void closeIfSupported(Object closeable)

  Attempt to call close() if supported.

  This is used when dealing with auto-closeable (duck-like) objects

  Parameters:
    `closeable` - the object we'd like to close

### isStrictEngine

    protected boolean isStrictEngine()

  Whether this interpreter is currently evaluating with a strict engine flag.

  Returns:
    true if strict engine, false otherwise

### isSilent

    protected boolean isSilent()

  Whether this interpreter is currently evaluating with a silent mode.

  Returns:
    true if silent, false otherwise

### isCancellable

    protected boolean isCancellable()

  Returns:
    true if interrupt throws a JexlException.Cancel.

### findNullOperand

    protected JexlNode findNullOperand(RuntimeException xrt,
                                       JexlNode node,
                                       Object left,
                                       Object right)

  Finds the node causing a NPE for diadic operators.

  Parameters:
    `xrt` - the RuntimeException
    `node` - the parent node
    `left` - the left argument
    `right` - the right argument
  Returns:
    the left, right or parent node

### unsolvableVariable

    protected Object unsolvableVariable(JexlNode node,
                                        String var,
                                        boolean undef)

  Triggered when a variable can not be resolved.

  Parameters:
    `node` - the node where the error originated from
    `var` - the variable name
    `undef` - whether the variable is undefined or null
  Returns:
    throws JexlException if strict and not silent, null otherwise

### unsolvableMethod

    protected Object unsolvableMethod(JexlNode node,
                                      String method)

  Triggered when a method can not be resolved.

  Parameters:
    `node` - the node where the error originated from
    `method` - the method name
  Returns:
    throws JexlException if strict and not silent, null otherwise

### unsolvableProperty

    protected Object unsolvableProperty(JexlNode node,
                                        String var,
                                        Throwable cause)

  Triggered when a property can not be resolved.

  Parameters:
    `node` - the node where the error originated from
    `var` - the property name
    `cause` - the cause if any
  Returns:
    throws JexlException if strict and not silent, null otherwise

### operatorError

    protected Object operatorError(JexlNode node,
                                   JexlOperator operator,
                                   Throwable cause)

  Triggered when an operator fails.

  Parameters:
    `node` - the node where the error originated from
    `operator` - the method name
    `cause` - the cause of error (if any)
  Returns:
    throws JexlException if strict and not silent, null otherwise

### annotationError

    protected Object annotationError(JexlNode node,
                                     String annotation,
                                     Throwable cause)

  Triggered when an annotation processing fails.

  Parameters:
    `node` - the node where the error originated from
    `annotation` - the annotation name
    `cause` - the cause of error (if any)
  Returns:
    throws a JexlException if strict and not silent, null otherwise

### invocationException

    protected JexlException invocationException(JexlNode node,
                                                String methodName,
                                                Exception xany)

  Triggered when method, function or constructor invocation fails with an exception.

  Parameters:
    `node` - the node triggering the exception
    `methodName` - the method/function name
    `xany` - the cause
  Returns:
    a JexlException that will be thrown

### cancel

    protected boolean cancel()

  Cancels this evaluation, setting the cancel flag that will result in a JexlException.Cancel to be thrown.

  Returns:
    false if already cancelled, true otherwise

### isCancelled

    protected boolean isCancelled()

  Checks whether this interpreter execution was cancelled due to thread interruption.

  Returns:
    true if cancelled, false otherwise

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001–2017 The Apache Software Foundation. All rights reserved.