org.teiid.query.sql.symbol
Class ScalarSubquery

java.lang.Object
  extended by org.teiid.query.sql.symbol.ScalarSubquery
All Implemented Interfaces:
java.lang.Cloneable, SubqueryContainer<QueryCommand>, LanguageObject, ContextReference, Expression

public class ScalarSubquery
extends java.lang.Object
implements Expression, SubqueryContainer<QueryCommand>, ContextReference

This is an Expression implementation that can be used in a SELECT clause. It has a subquery Command which must only produce exactly one value (or an Exception will result during query processing). It's type will be the type of the one symbol to be produced. In theory an instance of this could be used wherever an Expression is legal, but it is specifically needed for the SELECT clause.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.teiid.query.sql.LanguageObject
LanguageObject.Util
 
Constructor Summary
ScalarSubquery(QueryCommand subqueryCommand)
           
 
Method Summary
 void acceptVisitor(LanguageVisitor visitor)
          Method for accepting a visitor.
 java.lang.Object clone()
          Returns a safe clone
 boolean equals(java.lang.Object obj)
          Compare this ScalarSubquery to another ScalarSubquery for equality.
 QueryCommand getCommand()
          Returns the subquery Command object
 java.lang.String getContextSymbol()
           
 java.lang.Class<?> getType()
          Get the return type of this expression.
 Expression getValueExpression()
           
 int hashCode()
          Get hashcode for the object
 boolean isResolved()
          Return true if expression has been fully resolved.
 void setCommand(QueryCommand command)
          Sets the command.
 void setShouldEvaluate(boolean shouldEvaluate)
           
 void setType(java.lang.Class<?> type)
          Set type of ScalarSubquery
 boolean shouldEvaluate()
           
 java.lang.String toString()
          Returns string representation of this object.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScalarSubquery

public ScalarSubquery(QueryCommand subqueryCommand)
Method Detail

shouldEvaluate

public boolean shouldEvaluate()

setShouldEvaluate

public void setShouldEvaluate(boolean shouldEvaluate)

getContextSymbol

public java.lang.String getContextSymbol()
Specified by:
getContextSymbol in interface ContextReference

getValueExpression

public Expression getValueExpression()
Specified by:
getValueExpression in interface ContextReference

isResolved

public boolean isResolved()
Description copied from interface: Expression
Return true if expression has been fully resolved. Typically the QueryResolver component will handle resolution of an expression.

Specified by:
isResolved in interface Expression
Returns:
True if resolved
See Also:
Expression.isResolved()

getType

public java.lang.Class<?> getType()
Description copied from interface: Expression
Get the return type of this expression. This method will not necessarily work right before resolution (Expression.isResolved() returns true).

Specified by:
getType in interface Expression
Returns:
Java class name
See Also:
Expression.getType()

setType

public void setType(java.lang.Class<?> type)
Set type of ScalarSubquery

Parameters:
type - New type

getCommand

public QueryCommand getCommand()
Description copied from interface: SubqueryContainer
Returns the subquery Command object

Specified by:
getCommand in interface SubqueryContainer<QueryCommand>
Returns:
the subquery Command object

setCommand

public void setCommand(QueryCommand command)
Sets the command. Also modifies the hash code of this object, so caution should be used in using this method.

Specified by:
setCommand in interface SubqueryContainer<QueryCommand>
Parameters:
command - the subquery Command object

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 interface LanguageObject
Parameters:
visitor - Visitor being used

equals

public boolean equals(java.lang.Object obj)
Compare this ScalarSubquery to another ScalarSubquery for equality.

Overrides:
equals in class java.lang.Object
Parameters:
obj - Other object
Returns:
true if objects are equal

hashCode

public int hashCode()
Get hashcode for the object

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

clone

public java.lang.Object clone()
Returns a safe clone

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

toString

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

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


Copyright © 2010. All Rights Reserved.