org.teiid.query.sql.symbol
Class ElementSymbol

java.lang.Object
  extended by org.teiid.query.sql.symbol.Symbol
      extended by org.teiid.query.sql.symbol.SelectSymbol
          extended by org.teiid.query.sql.symbol.SingleElementSymbol
              extended by org.teiid.query.sql.symbol.ElementSymbol
All Implemented Interfaces:
java.lang.Cloneable, LanguageObject, Expression

public class ElementSymbol
extends SingleElementSymbol

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
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.SingleElementSymbol
SEPARATOR
 
Constructor Summary
  ElementSymbol(java.lang.String name)
          Simple constructor taking just a name.
  ElementSymbol(java.lang.String name, boolean displayFullyQualified)
          Constructor taking a name and a flag whether to display fully qualified.
protected ElementSymbol(java.lang.String name, java.lang.String canonicalName)
          Constructor used for cloning
 
Method Summary
 void acceptVisitor(LanguageVisitor visitor)
          Method for accepting a visitor.
 java.lang.Object clone()
          Return a deep copy of this object.
 boolean getDisplayFullyQualified()
          Get whether this element will be displayed as fully qualified
 ElementSymbol.DisplayMode getDisplayMode()
           
 GroupSymbol getGroupSymbol()
          Get the group symbol referred to by this element symbol, may be null before resolution
 java.lang.Object getMetadataID()
          Get the metadata ID reference
 java.lang.Class getType()
          Get the type of the symbol
 boolean isExternalReference()
          Get whether this element is an external reference to a group outside the command context.
 boolean isResolved()
          If metadataID is not null and type is not null return true, else return false
 void setDisplayFullyQualified(boolean displayFullyQualified)
          Set whether this element will be displayed as fully qualified
 void setDisplayMode(ElementSymbol.DisplayMode displayMode)
           
 void setGroupSymbol(GroupSymbol symbol)
          Set the group symbol referred to by this element symbol
 void setIsExternalReference(boolean isExternalReference)
          Set whether this element is an external reference.
 void setMetadataID(java.lang.Object metadataID)
          Set the metadata ID reference for this element
 void setType(java.lang.Class type)
          Set the type of the symbol
 
Methods inherited from class org.teiid.query.sql.symbol.SingleElementSymbol
getShortCanonicalName, getShortName, getShortName
 
Methods inherited from class org.teiid.query.sql.symbol.Symbol
equals, getCanonical, getCanonicalName, getName, getOutputName, hashCode, setName, setOutputName, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ElementSymbol

protected ElementSymbol(java.lang.String name,
                        java.lang.String canonicalName)
Constructor used for cloning

Parameters:
name -
canonicalName -
Since:
4.3

ElementSymbol

public ElementSymbol(java.lang.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(java.lang.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

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 java.lang.Object getMetadataID()
Get the metadata ID reference

Returns:
Metadata ID reference, may be null before resolution

setMetadataID

public void setMetadataID(java.lang.Object metadataID)
Set the metadata ID reference for this element

Parameters:
metadataID - Metadata ID reference

getType

public java.lang.Class getType()
Get the type of the symbol

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

setType

public void setType(java.lang.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.

Parameters:
visitor - Visitor being used

isResolved

public boolean isResolved()
If metadataID is not null and type is not null return true, else return false

Specified by:
isResolved in interface Expression
Specified by:
isResolved in class Symbol
Returns:
boolean if metadataID is null or not

clone

public java.lang.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


Copyright © 2010. All Rights Reserved.