Package org.teiid.query.sql.symbol
Class Symbol
- java.lang.Object
-
- org.teiid.query.sql.symbol.Symbol
-
- All Implemented Interfaces:
Cloneable
,LanguageObject
- Direct Known Subclasses:
AliasSymbol
,ElementSymbol
,ExpressionSymbol
,GroupSymbol
public abstract class Symbol extends Object implements LanguageObject
This is the server's representation of a metadata symbol. The only thing a symbol has to have is a name. This name relates only to how a symbol is specified in a user's query and does not necessarily relate to any actual metadata identifier (although it may). Subclasses of this class provide specialized instances of symbol for various circumstances in a user's query. In the context of a single query, a symbol's name has a unique meaning although it may be used more than once in some circumstances.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.teiid.query.sql.LanguageObject
LanguageObject.Util
-
-
Field Summary
Fields Modifier and Type Field Description protected String
outputName
Prior to resolving null, after resolving it is the exact string entered in the query.static String
SEPARATOR
Character used to delimit name components in a symbol
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Object
clone()
Return a copy of this object.boolean
equals(Object obj)
Compare the symbol based ONLY on name.String
getName()
Get the name of the symbolstatic String
getName(Expression ex)
String
getOutputName()
static String
getOutputName(Expression ex)
String
getShortName()
Get the short name of the elementstatic String
getShortName(String name)
static String
getShortName(Expression ex)
int
hashCode()
Return a hash code for this symbol.protected void
setName(String name)
void
setOutputName(String outputName)
void
setShortName(String name)
Change the symbol's name.String
toString()
Returns string representation of this symbol.-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.teiid.query.sql.LanguageObject
acceptVisitor
-
-
-
-
Field Detail
-
outputName
protected String outputName
Prior to resolving null, after resolving it is the exact string entered in the query. The AliasGenerator can also set this value as necessary for the data tier.
-
SEPARATOR
public static final String SEPARATOR
Character used to delimit name components in a symbol- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Symbol
public Symbol(String name)
Construct a symbol with a name.- Parameters:
name
- Name of the symbol- Throws:
IllegalArgumentException
- If name is null
-
Symbol
public Symbol()
-
-
Method Detail
-
setName
protected void setName(String name)
-
setShortName
public void setShortName(String name)
Change the symbol's name. This will change the symbol's hash code and canonical name!!!!!!!!!!!!!!!!! If this symbol is in a hashed collection, it will be lost!- Parameters:
name
- New name
-
getName
public String getName()
Get the name of the symbol- Returns:
- Name of the symbol, never null
-
toString
public String toString()
Returns string representation of this symbol.
-
hashCode
public int hashCode()
Return a hash code for this symbol.
-
equals
public boolean equals(Object obj)
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.
-
clone
public abstract Object clone()
Return a copy of this object.- Specified by:
clone
in interfaceLanguageObject
- Overrides:
clone
in classObject
- Returns:
- Deep clone of this object
-
getOutputName
public String getOutputName()
-
setOutputName
public void setOutputName(String outputName)
-
getShortName
public final String getShortName()
Get the short name of the element- Returns:
- Short name of the symbol (un-dotted)
-
getShortName
public static String getShortName(Expression ex)
-
getName
public static String getName(Expression ex)
-
getOutputName
public static String getOutputName(Expression ex)
-
-