Class 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 Detail

      • 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,
                              java.lang.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,
                              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 node
        properties - 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 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 java.lang.String toString()
        Overrides:
        toString in class java.lang.Object