java.lang.Object
org.apache.sling.scripting.sightly.compiler.expression.nodes.PropertyAccess
All Implemented Interfaces:
ExpressionNode

public final class PropertyAccess extends Object implements ExpressionNode
Defines an expression in which an object is queried for a specific property (e.g. obj.prop).
  • Constructor Details

    • PropertyAccess

      public PropertyAccess(ExpressionNode target, ExpressionNode property)
      Creates a property access node.
      Parameters:
      target - the expression for the object being accessed
      property - the expression identifying the object's accessed property
    • PropertyAccess

      public PropertyAccess(ExpressionNode target, String property)
      Creates a property access node.
      Parameters:
      target - the expression for the object being accessed
      property - the name of the accessed property
    • PropertyAccess

      public PropertyAccess(ExpressionNode target, Iterable<String> properties)
      Builds a chained property access node with the given target and the specified properties.
      Parameters:
      target - the target node
      properties - a non-empty list of property names
      Throws:
      IllegalArgumentException - if the list of properties is empty
  • Method Details

    • accept

      public <T> T accept(NodeVisitor<T> visitor)
      Description copied from interface: ExpressionNode
      Accept a visitor to process this node.
      Specified by:
      accept in interface ExpressionNode
      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 String toString()
      Overrides:
      toString in class Object