Class Expression
- java.lang.Object
-
- org.apache.sling.scripting.sightly.compiler.expression.Expression
-
public final class Expression extends java.lang.Object
This class represents a HTL Expression.
-
-
Constructor Summary
Constructors Constructor Description Expression(ExpressionNode root)
Create an expression with just a root node.Expression(ExpressionNode root, java.util.Map<java.lang.String,ExpressionNode> options)
Create an expression with a root node and options.Expression(ExpressionNode root, java.util.Map<java.lang.String,ExpressionNode> options, java.lang.String rawText)
Create an expression with a root node and options.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsOption(java.lang.String name)
Checks whether the expression has the specified option.java.util.Map<java.lang.String,ExpressionNode>
getOptions()
Get the options for this expression.java.lang.String
getRawText()
Returns the raw text representation of this expression.ExpressionNode
getRoot()
Get the root node of this expression.ExpressionNode
removeOption(java.lang.String option)
Removes the given option from this expression.java.lang.String
toString()
Expression
withNode(ExpressionNode node)
Return a copy, but with the specified node as root.Expression
withRawText(java.lang.String rawText)
Return a copy that provides information about the expression's raw text.
-
-
-
Constructor Detail
-
Expression
public Expression(ExpressionNode root)
Create an expression with just a root node.- Parameters:
root
- the root node
-
Expression
public Expression(ExpressionNode root, java.util.Map<java.lang.String,ExpressionNode> options)
Create an expression with a root node and options.- Parameters:
root
- the root nodeoptions
- the expression's options
-
Expression
public Expression(ExpressionNode root, java.util.Map<java.lang.String,ExpressionNode> options, java.lang.String rawText)
Create an expression with a root node and options.- Parameters:
root
- the root nodeoptions
- the expression's optionsrawText
- the expression's raw text representation
-
-
Method Detail
-
getOptions
public java.util.Map<java.lang.String,ExpressionNode> getOptions()
Get the options for this expression.- Returns:
- the expression options
-
getRoot
public ExpressionNode getRoot()
Get the root node of this expression.- Returns:
- the root node of this expression
-
removeOption
public ExpressionNode removeOption(java.lang.String option)
Removes the given option from this expression.- Parameters:
option
- the option to be removed- Returns:
- the option, or
null
if the option doesn't exist
-
withNode
public Expression withNode(ExpressionNode node)
Return a copy, but with the specified node as root.- Parameters:
node
- the new root- Returns:
- a copy with a new root
-
withRawText
public Expression withRawText(java.lang.String rawText)
Return a copy that provides information about the expression's raw text.- Parameters:
rawText
- the raw text representing the expression- Returns:
- a copy with information about the expression's raw text
-
getRawText
public java.lang.String getRawText()
Returns the raw text representation of this expression.- Returns:
- the raw text representation of this expression
-
containsOption
public boolean containsOption(java.lang.String name)
Checks whether the expression has the specified option.- Parameters:
name
- the name of the option- Returns:
true
if the option is present,false
otherwise
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-