Package org.teiid.query.sql.symbol
Class ElementSymbol
- java.lang.Object
-
- org.teiid.query.sql.symbol.Symbol
-
- org.teiid.query.sql.symbol.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ElementSymbol.DisplayMode
-
Nested classes/interfaces inherited from interface org.teiid.query.sql.LanguageObject
LanguageObject.Util
-
-
Field Summary
-
Fields inherited from class org.teiid.query.sql.symbol.Symbol
outputName, SEPARATOR
-
-
Constructor Summary
Constructors Constructor Description ElementSymbol(String name)
Simple constructor taking just a name.ElementSymbol(String name, boolean displayFullyQualified)
Constructor taking a name and a flag whether to display fully qualified.ElementSymbol(String shortName, GroupSymbol group)
ElementSymbol(String shortName, GroupSymbol group, Class<?> type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acceptVisitor(LanguageVisitor visitor)
Method for accepting a visitor.ElementSymbol
clone()
Return a deep copy of this object.boolean
equals(Object obj)
Compare the symbol based ONLY on name.boolean
getDisplayFullyQualified()
Get whether this element will be displayed as fully qualifiedElementSymbol.DisplayMode
getDisplayMode()
GroupSymbol
getGroupSymbol()
Get the group symbol referred to by this element symbol, may be null before resolutionObject
getMetadataID()
Get the metadata ID referenceString
getName()
Get the name of the symbolClass<?>
getType()
Get the type of the symbolint
hashCode()
Return a hash code for this symbol.boolean
isAggregate()
boolean
isExternalReference()
Get whether this element is an external reference to a group outside the command context.void
setAggregate(boolean isAggregate)
void
setDisplayFullyQualified(boolean displayFullyQualified)
Set whether this element will be displayed as fully qualifiedvoid
setDisplayMode(ElementSymbol.DisplayMode displayMode)
void
setGroupSymbol(GroupSymbol symbol)
Set the group symbol referred to by this element symbolvoid
setIsExternalReference(boolean isExternalReference)
Set whether this element is an external reference.void
setMetadataID(Object metadataID)
Set the metadata ID reference for this elementprotected void
setName(String name)
void
setType(Class<?> type)
Set the type of the symbol-
Methods inherited from class org.teiid.query.sql.symbol.Symbol
getName, getOutputName, getOutputName, getShortName, getShortName, getShortName, setOutputName, setShortName, toString
-
-
-
-
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 shortName, GroupSymbol group)
-
ElementSymbol
public ElementSymbol(String shortName, GroupSymbol group, Class<?> type)
-
ElementSymbol
public ElementSymbol(String name, boolean displayFullyQualified)
Constructor taking a name and a flag whether to display fully qualified.- Parameters:
name
- Name of the symboldisplayFullyQualified
- True if should display fully qualified
-
-
Method Detail
-
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.
-
hashCode
public int hashCode()
Description copied from class:Symbol
Return a hash code for this symbol.
-
setDisplayMode
public void setDisplayMode(ElementSymbol.DisplayMode displayMode)
-
getDisplayMode
public ElementSymbol.DisplayMode getDisplayMode()
-
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 interfaceExpression
- 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 interfaceLanguageObject
- Parameters:
visitor
- Visitor being used
-
clone
public ElementSymbol clone()
Return a deep copy of this object.- Specified by:
clone
in interfaceLanguageObject
- Specified by:
clone
in classSymbol
- Returns:
- Deep copy of this object
-
isAggregate
public boolean isAggregate()
-
setAggregate
public void setAggregate(boolean isAggregate)
-
-