Class PropertyAccess
- java.lang.Object
-
- org.apache.sling.scripting.sightly.compiler.expression.nodes.PropertyAccess
-
- All Implemented Interfaces:
ExpressionNode
public final class PropertyAccess extends java.lang.Object implements ExpressionNode
Defines an expression in which an object is queried for a specific property (e.g.obj.prop
).
-
-
Constructor Summary
Constructors Constructor Description PropertyAccess(ExpressionNode target, java.lang.Iterable<java.lang.String> properties)
Builds a chained property access node with the given target and the specified properties.PropertyAccess(ExpressionNode target, java.lang.String property)
Creates a property access node.PropertyAccess(ExpressionNode target, ExpressionNode property)
Creates a property access node.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
accept(NodeVisitor<T> visitor)
Accept a visitor to process this node.ExpressionNode
getProperty()
Returns the expression node identifying the accessed property.ExpressionNode
getTarget()
The object being accessed.java.lang.String
toString()
-
-
-
Constructor Detail
-
PropertyAccess
public PropertyAccess(ExpressionNode target, ExpressionNode property)
Creates a property access node.- Parameters:
target
- the expression for the object being accessedproperty
- the expression identifying the object's accessed property
-
PropertyAccess
public PropertyAccess(ExpressionNode target, java.lang.String property)
Creates a property access node.- Parameters:
target
- the expression for the object being accessedproperty
- the name of the accessed property
-
PropertyAccess
public PropertyAccess(ExpressionNode target, java.lang.Iterable<java.lang.String> properties)
Builds a chained property access node with the given target and the specified properties.- Parameters:
target
- the target nodeproperties
- a non-empty list of property names- Throws:
java.lang.IllegalArgumentException
- if the list of properties is empty
-
-
Method Detail
-
accept
public <T> T accept(NodeVisitor<T> visitor)
Description copied from interface:ExpressionNode
Accept a visitor to process this node.- Specified by:
accept
in interfaceExpressionNode
- Type Parameters:
T
- the type of the visitor- Parameters:
visitor
- The visitor- Returns:
- the node after it has been evaluated by the visitor
-
getTarget
public ExpressionNode getTarget()
The object being accessed.- Returns:
- a node representing the object being accessed
-
getProperty
public ExpressionNode getProperty()
Returns the expression node identifying the accessed property.- Returns:
- the expression node identifying the accessed property
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-