Package org.apache.commons.jexl3.parser
Class ASTJexlScript
- java.lang.Object
-
- org.apache.commons.jexl3.parser.SimpleNode
-
- org.apache.commons.jexl3.parser.JexlNode
-
- org.apache.commons.jexl3.parser.JexlLexicalNode
-
- org.apache.commons.jexl3.parser.ASTJexlScript
-
- All Implemented Interfaces:
JexlParser.LexicalUnit
,Node
- Direct Known Subclasses:
ASTJexlLambda
public class ASTJexlScript extends JexlLexicalNode
Enhanced script to allow parameters declaration.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.commons.jexl3.parser.JexlNode
JexlNode.Constant<T>, JexlNode.Funcall, JexlNode.Info
-
-
Field Summary
Fields Modifier and Type Field Description private JexlFeatures
features
Features.private java.util.Map<java.lang.String,java.lang.Object>
pragmas
The pragmas.private Scope
scope
The script scope.private static long
serialVersionUID
Serial uid.-
Fields inherited from class org.apache.commons.jexl3.parser.SimpleNode
id
-
-
Constructor Summary
Constructors Constructor Description ASTJexlScript(int id)
ASTJexlScript(Parser p, int id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Frame
createFrame(java.lang.Object... values)
Creates an array of arguments by copying values up to the number of parameters.Frame
createFrame(Frame caller, java.lang.Object... values)
Creates an array of arguments by copying values up to the number of parameters.int
getArgCount()
Gets the (maximum) number of arguments this script expects.java.lang.String[]
getCapturedVariables()
Gets this script captured variable, i.e.JexlFeatures
getFeatures()
java.lang.String[]
getLocalVariables()
Gets this script local variable, i.e.java.lang.String[]
getParameters()
Gets this script parameters, i.e.java.util.Map<java.lang.String,java.lang.Object>
getPragmas()
Scope
getScope()
java.lang.String[]
getSymbols()
Gets this script symbols, i.e.boolean
isCapturedSymbol(int symbol)
Checks whether a given symbol is captured.java.lang.Object
jjtAccept(ParserVisitor visitor, java.lang.Object data)
Accepts the visitor.ASTJexlScript
script()
Consider script with no parameters that return lambda as parametric-scripts.void
setFeatures(JexlFeatures theFeatures)
Sets this script features.void
setPragmas(java.util.Map<java.lang.String,java.lang.Object> thePragmas)
Sets this script pragmas.void
setScope(Scope theScope)
Sets this script scope.-
Methods inherited from class org.apache.commons.jexl3.parser.JexlLexicalNode
declareSymbol, getLexicalScope, getSymbolCount, hasSymbol, isConstant, jjtClose, setConstant
-
Methods inherited from class org.apache.commons.jexl3.parser.JexlNode
clearCache, getColumn, getLine, isConstant, isConstant, isGlobalVar, isLeftValue, isSafeLhs, isStrictOperator, jexlInfo, jjtSetFirstToken, jjtSetLastToken
-
Methods inherited from class org.apache.commons.jexl3.parser.SimpleNode
childrenAccept, dump, dumpOut, getId, jjtAddChild, jjtGetChild, jjtGetNumChildren, jjtGetParent, jjtGetValue, jjtOpen, jjtSetChildren, jjtSetParent, jjtSetValue, toString, toString
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Serial uid.- See Also:
- Constant Field Values
-
pragmas
private java.util.Map<java.lang.String,java.lang.Object> pragmas
The pragmas.
-
features
private transient JexlFeatures features
Features.
-
scope
private transient Scope scope
The script scope.
-
-
Constructor Detail
-
ASTJexlScript
public ASTJexlScript(int id)
-
ASTJexlScript
public ASTJexlScript(Parser p, int id)
-
-
Method Detail
-
createFrame
public Frame createFrame(Frame caller, java.lang.Object... values)
Creates an array of arguments by copying values up to the number of parameters.- Parameters:
caller
- the calling framevalues
- the argument values- Returns:
- the arguments array
-
createFrame
public Frame createFrame(java.lang.Object... values)
Creates an array of arguments by copying values up to the number of parameters.- Parameters:
values
- the argument values- Returns:
- the arguments array
-
getArgCount
public int getArgCount()
Gets the (maximum) number of arguments this script expects.- Returns:
- the number of parameters
-
getCapturedVariables
public java.lang.String[] getCapturedVariables()
Gets this script captured variable, i.e. symbols captured from outer scopes.- Returns:
- the captured variable names
-
getFeatures
public JexlFeatures getFeatures()
- Returns:
- this script scope
-
getLocalVariables
public java.lang.String[] getLocalVariables()
Gets this script local variable, i.e. symbols assigned to local variables.- Returns:
- the local variable names
-
getParameters
public java.lang.String[] getParameters()
Gets this script parameters, i.e. symbols assigned before creating local variables.- Returns:
- the parameter names
-
getPragmas
public java.util.Map<java.lang.String,java.lang.Object> getPragmas()
- Returns:
- this script pragmas.
-
getScope
public Scope getScope()
- Returns:
- this script scope
-
getSymbols
public java.lang.String[] getSymbols()
Gets this script symbols, i.e. parameters and local variables.- Returns:
- the symbol names
-
isCapturedSymbol
public boolean isCapturedSymbol(int symbol)
Checks whether a given symbol is captured.- Parameters:
symbol
- the symbol number- Returns:
- true if captured, false otherwise
-
jjtAccept
public java.lang.Object jjtAccept(ParserVisitor visitor, java.lang.Object data)
Description copied from class:SimpleNode
Accepts the visitor.- Specified by:
jjtAccept
in interfaceNode
- Overrides:
jjtAccept
in classSimpleNode
- Parameters:
visitor
- the visitordata
- contextual data- Returns:
- result of visit
-
script
public ASTJexlScript script()
Consider script with no parameters that return lambda as parametric-scripts.- Returns:
- the script
-
setFeatures
public void setFeatures(JexlFeatures theFeatures)
Sets this script features.- Parameters:
theFeatures
- the features
-
setPragmas
public void setPragmas(java.util.Map<java.lang.String,java.lang.Object> thePragmas)
Sets this script pragmas.- Parameters:
thePragmas
- the pragmas
-
setScope
public void setScope(Scope theScope)
Sets this script scope.- Parameters:
theScope
- the scope
-
-