Package org.apache.commons.jexl3.parser
Class JexlNode
- java.lang.Object
-
- org.apache.commons.jexl3.parser.SimpleNode
-
- org.apache.commons.jexl3.parser.JexlNode
-
- All Implemented Interfaces:
JexlCache.Reference,Node
- Direct Known Subclasses:
ASTAddNode,ASTAmbiguous,ASTAndNode,ASTAnnotatedStatement,ASTAnnotation,ASTArguments,ASTAssignment,ASTBitwiseAndNode,ASTBitwiseComplNode,ASTBitwiseOrNode,ASTBitwiseXorNode,ASTBreak,ASTCaseStatement,ASTConstructorNode,ASTContinue,ASTDecrementGetNode,ASTDefineVars,ASTDivNode,ASTDoWhileStatement,ASTEmptyFunction,ASTEQNode,ASTEQSNode,ASTERNode,ASTEWNode,ASTExtendedLiteral,ASTFalseNode,ASTFunctionNode,ASTGENode,ASTGetDecrementNode,ASTGetIncrementNode,ASTGTNode,ASTIdentifier,ASTIdentifierAccess,ASTIfStatement,ASTIncrementGetNode,ASTInstanceOf,ASTJxltLiteral,ASTLENode,ASTLTNode,ASTMapEntry,ASTMethodNode,ASTModNode,ASTMulNode,ASTNENode,ASTNESNode,ASTNEWNode,ASTNotInstanceOf,ASTNotNode,ASTNRNode,ASTNSWNode,ASTNullLiteral,ASTNullpNode,ASTNumberLiteral,ASTOrNode,ASTQualifiedIdentifier,ASTRangeNode,ASTReference,ASTReferenceExpression,ASTRegexLiteral,ASTReturnStatement,ASTSetAddNode,ASTSetAndNode,ASTSetDivNode,ASTSetModNode,ASTSetMultNode,ASTSetOrNode,ASTSetShiftLeftNode,ASTSetShiftRightNode,ASTSetShiftRightUnsignedNode,ASTSetSubNode,ASTSetXorNode,ASTShiftLeftNode,ASTShiftRightNode,ASTShiftRightUnsignedNode,ASTSizeFunction,ASTStringLiteral,ASTSubNode,ASTSwitchStatement,ASTSWNode,ASTTernaryNode,ASTThrowStatement,ASTTrueNode,ASTUnaryMinusNode,ASTUnaryPlusNode,ASTWhileStatement,ExtensibleNode,JexlLexicalNode
public abstract class JexlNode extends SimpleNode implements JexlCache.Reference
Base class for parser nodes - holds an 'image' of the token for later use.- Since:
- 2.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceJexlNode.Constant<T>A marker interface for constants.static interfaceJexlNode.FuncallMarker interface for cachable function calls.static classJexlNode.InfoAn info bound to its node.static interfaceJexlNode.JxltHandleMarker interface for nodes hosting a JxltExpression.
-
Field Summary
Fields Modifier and Type Field Description private intlcprivate static longserialVersionUID-
Fields inherited from class org.apache.commons.jexl3.parser.SimpleNode
id
-
-
Constructor Summary
Constructors Constructor Description JexlNode(int id)JexlNode(Parser p, int id)Deprecated.UseJexlNode(int).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearCache()Clears any cached value of type JexlProperty{G,S}et or JexlMethod.java.lang.ObjectgetCache()Gets the referenced object.intgetColumn()intgetLine()booleanisConstant()Tests whether this node is a constant node.protected booleanisConstant(boolean literal)booleanisGlobalVar()booleanisLeftValue()Tests whether this node is a left value.booleanisSafeLhs(boolean safe)Tests whether this node is the left-hand side of a safe access identifier as in.booleanisStrictOperator(JexlArithmetic arithmetic)Checks whether this node is an operator that accepts a null argument even when arithmetic is in strict mode.JexlInfojexlInfo()Gets the associated JexlInfo instance.JexlInfojexlInfo(java.lang.String name)Gets the associated JexlInfo instance.voidjjtSetFirstToken(Token t)voidjjtSetLastToken(Token t)voidsetCache(java.lang.Object cache)Sets the referenced object.-
Methods inherited from class org.apache.commons.jexl3.parser.SimpleNode
childrenAccept, dump, dumpOut, getId, jjtAccept, jjtAddChild, jjtClose, jjtGetChild, jjtGetNumChildren, jjtGetParent, jjtGetValue, jjtOpen, jjtSetChildren, jjtSetParent, jjtSetValue, toString, toString
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
lc
private int lc
-
-
Constructor Detail
-
JexlNode
public JexlNode(int id)
-
JexlNode
@Deprecated public JexlNode(Parser p, int id)
Deprecated.UseJexlNode(int).Constructs a new instance.- Parameters:
p- not used.id- the node type identifier
-
-
Method Detail
-
getCache
public java.lang.Object getCache()
Description copied from interface:JexlCache.ReferenceGets the referenced object.- Specified by:
getCachein interfaceJexlCache.Reference- Returns:
- the referenced object
-
setCache
public void setCache(java.lang.Object cache)
Description copied from interface:JexlCache.ReferenceSets the referenced object.- Specified by:
setCachein interfaceJexlCache.Reference- Parameters:
cache- the referenced object
-
clearCache
public void clearCache()
Clears any cached value of type JexlProperty{G,S}et or JexlMethod.This is called when the engine detects the evaluation of a script occurs with a class loader different that the one that created it.
-
getColumn
public int getColumn()
-
getLine
public int getLine()
-
isConstant
public boolean isConstant()
Tests whether this node is a constant node.Its value cannot change after the first evaluation and can be cached indefinitely.
- Returns:
- true if constant, false otherwise
-
isConstant
protected boolean isConstant(boolean literal)
-
isGlobalVar
public boolean isGlobalVar()
- Returns:
- true if this node looks like a global var
-
isLeftValue
public boolean isLeftValue()
Tests whether this node is a left value.- Returns:
- true if node is assignable, false otherwise
-
isSafeLhs
public boolean isSafeLhs(boolean safe)
Tests whether this node is the left-hand side of a safe access identifier as in. For instance, in 'x?.y' , 'x' is safe.- Parameters:
safe- whether the engine is in safe-navigation mode- Returns:
- true if safe lhs, false otherwise
-
isStrictOperator
public boolean isStrictOperator(JexlArithmetic arithmetic)
Checks whether this node is an operator that accepts a null argument even when arithmetic is in strict mode. The default cases are equals and not equals.- Parameters:
arithmetic- the node to test- Returns:
- true if node accepts null arguments, false otherwise
-
jexlInfo
public JexlInfo jexlInfo()
Gets the associated JexlInfo instance.- Returns:
- the info
-
jexlInfo
public JexlInfo jexlInfo(java.lang.String name)
Gets the associated JexlInfo instance.- Parameters:
name- the source name- Returns:
- the info
-
jjtSetFirstToken
public void jjtSetFirstToken(Token t)
-
jjtSetLastToken
public void jjtSetLastToken(Token t)
-
-