com.metamatrix.query.sql.symbol
Class Symbol

java.lang.Object
  extended by com.metamatrix.query.sql.symbol.Symbol
All Implemented Interfaces:
LanguageObject, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
GroupSymbol, SelectSymbol

public abstract class Symbol
extends java.lang.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.

See Also:
Serialized Form

Constructor Summary
  Symbol(java.lang.String name)
          Construct a symbol with a name.
protected Symbol(java.lang.String name, java.lang.String canonicalName)
          Constructor to be used for cloning instances.
 
Method Summary
abstract  java.lang.Object clone()
          Return a copy of this object.
 boolean equals(java.lang.Object obj)
          Compare the symbol based ONLY on name.
protected  java.lang.String getCanonical()
           
 java.lang.String getCanonicalName()
          Get canonical name for comparisons
 java.lang.String getName()
          Get the name of the symbol
 java.lang.String getOutputName()
           
 int hashCode()
          Return a hash code for this symbol.
abstract  boolean isResolved()
          Returns true if this symbol has been completely resolved with respect to actual runtime metadata.
 void setName(java.lang.String name)
          Change the symbol's name.
 void setOutputName(java.lang.String outputName)
           
 java.lang.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 com.metamatrix.query.sql.LanguageObject
acceptVisitor
 

Constructor Detail

Symbol

protected Symbol(java.lang.String name,
                 java.lang.String canonicalName)
Constructor to be used for cloning instances. Calls to String.toUpperCase() to generate the canonical names were the big performance hit during cloning, so this method allows subclasses to simply pass in the canonical name to avoid toUpperCase().

Parameters:
name -
canonicalName -
Since:
4.3

Symbol

public Symbol(java.lang.String name)
Construct a symbol with a name.

Parameters:
name - Name of the symbol
Throws:
java.lang.IllegalArgumentException - If name is null
Method Detail

setName

public void setName(java.lang.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 java.lang.String getName()
Get the name of the symbol

Returns:
Name of the symbol, never null

getCanonicalName

public java.lang.String getCanonicalName()
Get canonical name for comparisons

Returns:
Canonical name for comparisons

isResolved

public abstract boolean isResolved()
Returns true if this symbol has been completely resolved with respect to actual runtime metadata. A resolved symbol has been validated that it refers to actual metadata and will have references to the real metadata IDs if necessary. Different types of symbols determine their resolution in different ways, so this method is abstract and must be implemented by subclasses.

Returns:
True if resolved with runtime metadata

toString

public java.lang.String toString()
Returns string representation of this symbol.

Overrides:
toString in class java.lang.Object
Returns:
String representing the symbol

hashCode

public int hashCode()
Return a hash code for this symbol.

Overrides:
hashCode in class java.lang.Object
Returns:
Hash code

equals

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

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

clone

public abstract java.lang.Object clone()
Return a copy of this object.

Specified by:
clone in interface LanguageObject
Overrides:
clone in class java.lang.Object
Returns:
Deep clone of this object

getCanonical

protected java.lang.String getCanonical()

getOutputName

public java.lang.String getOutputName()

setOutputName

public void setOutputName(java.lang.String outputName)


Copyright © 2009. All Rights Reserved.