Class ElementSymbol

  • All Implemented Interfaces:
    Cloneable, LanguageObject, DerivedExpression, Expression

    public class ElementSymbol
    extends Symbol
    implements DerivedExpression

    This is a subclass of Symbol representing a single element. An ElementSymbol also is an expression and thus has a type. Element symbols have a variety of attributes that determine how they are displayed - a flag for displaying fully qualified and an optional vdb name.

    The "isExternalReference" property indicates whether the element symbol refers to an element from a group outside the current command. Typically this is set to false. Common uses when this is set to true are for variables used within a command, correlated elements within a command, etc.

    • Constructor Detail

      • ElementSymbol

        public ElementSymbol​(String name)
        Simple constructor taking just a name. By default will display fully qualified name
        Parameters:
        name - Name of the symbol, may or may not be fully qualified
      • ElementSymbol

        public ElementSymbol​(String name,
                             boolean displayFullyQualified)
        Constructor taking a name and a flag whether to display fully qualified.
        Parameters:
        name - Name of the symbol
        displayFullyQualified - True if should display fully qualified
    • Method Detail

      • getName

        public String getName()
        Description copied from class: Symbol
        Get the name of the symbol
        Overrides:
        getName in class Symbol
        Returns:
        Name of the symbol, never null
      • equals

        public boolean equals​(Object obj)
        Description copied from class: Symbol
        Compare the symbol based ONLY on name. Symbols are not compared based on their underlying physical metadata IDs but rather on their representation in the context of a particular query. Case is not important when comparing symbol names.
        Overrides:
        equals in class Symbol
        Parameters:
        obj - Other object
        Returns:
        True if other obj is a Symbol (or subclass) and name is equal
      • hashCode

        public int hashCode()
        Description copied from class: Symbol
        Return a hash code for this symbol.
        Overrides:
        hashCode in class Symbol
        Returns:
        Hash code
      • setDisplayFullyQualified

        public void setDisplayFullyQualified​(boolean displayFullyQualified)
        Set whether this element will be displayed as fully qualified
        Parameters:
        displayFullyQualified - True if should display fully qualified
      • getDisplayFullyQualified

        public boolean getDisplayFullyQualified()
        Get whether this element will be displayed as fully qualified
        Returns:
        True if should display fully qualified
      • setIsExternalReference

        public void setIsExternalReference​(boolean isExternalReference)
        Set whether this element is an external reference. An external reference is an element that comes from a group outside the current command context. Typical uses would be variables and correlated references in subqueries.
        Parameters:
        isExternalReference - True if element is an external reference
      • isExternalReference

        public boolean isExternalReference()
        Get whether this element is an external reference to a group outside the command context.
        Returns:
        True if element is an external reference
      • setGroupSymbol

        public void setGroupSymbol​(GroupSymbol symbol)
        Set the group symbol referred to by this element symbol
        Parameters:
        symbol - the group symbol to set
      • getGroupSymbol

        public GroupSymbol getGroupSymbol()
        Get the group symbol referred to by this element symbol, may be null before resolution
        Returns:
        Group symbol referred to by this element, may be null
      • getMetadataID

        public Object getMetadataID()
        Get the metadata ID reference
        Returns:
        Metadata ID reference, may be null before resolution
      • setMetadataID

        public void setMetadataID​(Object metadataID)
        Set the metadata ID reference for this element
        Parameters:
        metadataID - Metadata ID reference
      • getType

        public Class<?> getType()
        Get the type of the symbol
        Specified by:
        getType in interface Expression
        Returns:
        Type of the symbol, may be null before resolution
      • setType

        public void setType​(Class<?> type)
        Set the type of the symbol
        Parameters:
        type - New type
      • acceptVisitor

        public void acceptVisitor​(LanguageVisitor visitor)
        Description copied from interface: LanguageObject
        Method for accepting a visitor. It is the responsibility of the language object to call back on the visitor.
        Specified by:
        acceptVisitor in interface LanguageObject
        Parameters:
        visitor - Visitor being used
      • isAggregate

        public boolean isAggregate()
      • setAggregate

        public void setAggregate​(boolean isAggregate)