Class FieldVariable

  • All Implemented Interfaces:
    ISemanticNode, IVariable

    public class FieldVariable
    extends SemanticNodeBase
    implements IVariable
    The field expression retrieves the value of a field from the instance returned by the parent expression. This expression is usually combined with a variable expression as the parent expression.
    Since:
    6.4
    Author:
    O. Kerpershoek, F. van der Meer
    • Constructor Detail

      • FieldVariable

        public FieldVariable​(ISemanticTreeBuilder semantics,
                             Position position,
                             IVariable parent,
                             Identifier fieldName)
        Constructs the node with the required arguments.
        Parameters:
        semantics - Semantic builder that may be used to request type information.
        position - Position information for the node.
        parent - The expression resulting in an instance containing the field.
        fieldName - The name of the field.
    • Method Detail

      • getIdentifier

        public Identifier getIdentifier()
        Description copied from interface: IVariable
        This method returns the identifier (entity name) of the variable.
        Specified by:
        getIdentifier in interface IVariable
        Returns:
        the identifier (entity name) of the variable.
      • getRootEntity

        public Identifier getRootEntity()
        Description copied from interface: IVariable
        This method returns the name of the entity that needs to be in scope to be able to resolve the variable.
        Specified by:
        getRootEntity in interface IVariable
        Returns:
        the name of the entity that needs to be in scope to be able to resolve the variable.
      • getParent

        public IVariable getParent()
        This method returns the parent variable.
        Returns:
        the parent variable.
      • getChildNodes

        public ISemanticNode[] getChildNodes()
        Description copied from interface: ISemanticNode
        This method returns an array containing the child nodes. The order of the child nodes in the array is not defined, and the array may be empty for nodes that do not have child nodes.
        Specified by:
        getChildNodes in interface ISemanticNode
        Returns:
        Array containing the child nodes of this node.
      • collectScopedObjects

        public void collectScopedObjects​(ScopedObjects resultSet)
        Description copied from interface: ISemanticNode
        This method may be used to collect the names of the objects that need to be in scope in order to evaluate the expression of this node. The object passed to the method will be enriched with the names of the objects that need to be in scope.
        Specified by:
        collectScopedObjects in interface ISemanticNode
        Parameters:
        resultSet - The object that should be used to add the names of the objects that need to be in scope to.
      • toAttributePath

        public String toAttributePath()
        Description copied from interface: IVariable
        This method returns a string containing a readable representation of the variable.
        Specified by:
        toAttributePath in interface IVariable
        Returns:
        a string containing a readable representation of the variable.
      • visit

        public void visit​(ISemanticNodeVisitor visitor)
        Description copied from interface: ISemanticNode
        This method allows a type safe visitation of the node. The visit method will not invoke the visitor for any child nodes.
        Specified by:
        visit in interface ISemanticNode
        Parameters:
        visitor - The visitor that should be invoked for this node.