Package org.apache.sling.scripting.sightly.compiler.expression

## Class Expression

- java.lang.Object
- - org.apache.sling.scripting.sightly.compiler.expression.Expression

    public final class Expression
    extends Object

This class represents a HTL Expression.

### Constructor Summary

Constructors
`Expression​(ExpressionNode root)` Create an expression with just a root node.
`Expression​(ExpressionNode root, Map<String,​ExpressionNode> options)` Create an expression with a root node and options.
`Expression​(ExpressionNode root, Map<String,​ExpressionNode> options, String rawText)` Create an expression with a root node and options.

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `containsOption​(String name)` Checks whether the expression has the specified option.
`Map<String,​ExpressionNode>` `getOptions()` Get the options for this expression.
`String` `getRawText()` Returns the raw text representation of this expression.
`ExpressionNode` `getRoot()` Get the root node of this expression.
`ExpressionNode` `removeOption​(String option)` Removes the given option from this expression.
`String` `toString()`
`Expression` `withNode​(ExpressionNode node)` Return a copy, but with the specified node as root.
`Expression` `withRawText​(String rawText)` Return a copy that provides information about the expression's raw text.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### 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,
                      Map<String,​ExpressionNode> options)

Create an expression with a root node and options.

Parameters:
  `root` - the root node
  `options` - the expression's options

#### Expression

    public Expression​(ExpressionNode root,
                      Map<String,​ExpressionNode> options,
                      String rawText)

Create an expression with a root node and options.

Parameters:
  `root` - the root node
  `options` - the expression's options
  `rawText` - the expression's raw text representation

### Method Detail

#### getOptions

    public Map<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​(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​(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 String getRawText()

Returns the raw text representation of this expression.

Returns:
  the raw text representation of this expression

#### containsOption

    public boolean containsOption​(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 String toString()

Overrides:
  `toString` in class `Object`