org.teiid.query.sql.symbol
Class ExpressionSymbol

java.lang.Object
  extended by org.teiid.query.sql.symbol.Symbol
      extended by org.teiid.query.sql.symbol.SingleElementSymbol
          extended by org.teiid.query.sql.symbol.ExpressionSymbol
All Implemented Interfaces:
Cloneable, LanguageObject, Expression, SelectSymbol
Direct Known Subclasses:
AggregateSymbol

public class ExpressionSymbol
extends SingleElementSymbol

This is a subclass of Symbol representing an expression in the SELECT clause. The expression may be a constant, function, or scalar subquery. The name of this symbol is always generated and typically should not be displayed. If necessary, the ExpressionSymbol may be wrapped by an AliasSymbol to register the name in a query. The definition of the symbol is the functional expression. Resolution will produce a list of groups and elements used by the expression.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.teiid.query.sql.LanguageObject
LanguageObject.Util
 
Field Summary
 
Fields inherited from class org.teiid.query.sql.symbol.SingleElementSymbol
SEPARATOR
 
Fields inherited from class org.teiid.query.sql.symbol.Symbol
outputName
 
Constructor Summary
  ExpressionSymbol(String name, Expression expression)
          Construct an ExpressionSymbol with name and expression.
protected ExpressionSymbol(String name, String canonicalName, Expression expression)
          Constructor used for cloning
 
Method Summary
 void acceptVisitor(LanguageVisitor visitor)
          Method for accepting a visitor.
 Object clone()
          Return a deep copy of this object
 boolean equals(Object obj)
          ExpressionSymbol matching is not based upon the name
 Expression getExpression()
          Get the expression for this symbol
 Class getType()
          Get the type of the symbol
 int hashCode()
          Return a hash code for this symbol.
 boolean isResolved()
          If elementSymbols is not null return true, else return false
 void setExpression(Expression expression)
          Set the expression represented by this symbol.
 
Methods inherited from class org.teiid.query.sql.symbol.SingleElementSymbol
getShortName
 
Methods inherited from class org.teiid.query.sql.symbol.Symbol
getCanonical, getCanonicalName, getName, getOutputName, getShortCanonicalName, getShortName, setName, setOutputName, setShortCanonicalName, setShortName, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExpressionSymbol

protected ExpressionSymbol(String name,
                           String canonicalName,
                           Expression expression)
Constructor used for cloning

Parameters:
name -
canonicalName -
Since:
4.3

ExpressionSymbol

public ExpressionSymbol(String name,
                        Expression expression)
Construct an ExpressionSymbol with name and expression.

Method Detail

getExpression

public Expression getExpression()
Get the expression for this symbol

Returns:
Expression for this symbol

setExpression

public void setExpression(Expression expression)
Set the expression represented by this symbol.

Parameters:
expression - Expression for this expression symbol

getType

public Class getType()
Get the type of the symbol

Returns:
Type of the symbol, may be null before resolution

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.

Parameters:
visitor - Visitor being used

isResolved

public boolean isResolved()
If elementSymbols is not null return true, else return false

Specified by:
isResolved in interface Expression
Specified by:
isResolved in class Symbol
Returns:
boolean True if expression symbol has been resolved to element symbols

clone

public Object clone()
Return a deep copy of this object

Specified by:
clone in interface LanguageObject
Specified by:
clone in class Symbol
Returns:
Deep copy of this object

hashCode

public int hashCode()
Description copied from class: Symbol
Return a hash code for this symbol.

Overrides:
hashCode in class Symbol
Returns:
Hash code
See Also:
Symbol.hashCode()

equals

public boolean equals(Object obj)
ExpressionSymbol matching is not based upon the name

Overrides:
equals in class Symbol
Parameters:
obj - Other object
Returns:
True if other obj is a Symbol (or subclass) and name is equal
See Also:
Symbol.equals(java.lang.Object)


Copyright © 2012. All Rights Reserved.