org.apache.derby.impl.sql.compile
Class StaticClassFieldReferenceNode

java.lang.Object
  extended by org.apache.derby.impl.sql.compile.QueryTreeNode
      extended by org.apache.derby.impl.sql.compile.JavaValueNode
          extended by org.apache.derby.impl.sql.compile.StaticClassFieldReferenceNode
All Implemented Interfaces:
Visitable

public final class StaticClassFieldReferenceNode
extends JavaValueNode

A StaticClassFieldReferenceNode represents a Java static field reference from a Class (as opposed to an Object). Field references can be made in DML (as expressions).


Field Summary
private  boolean classNameDelimitedIdentifier
           
private  java.lang.reflect.Member field
          The field we are going to access.
private  java.lang.String fieldName
           
private  java.lang.String javaClassName
           
 
Fields inherited from class org.apache.derby.impl.sql.compile.JavaValueNode
forCallStatement, jsqlType
 
Fields inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, isPrivilegeCollectionRequired
 
Constructor Summary
StaticClassFieldReferenceNode()
           
 
Method Summary
 JavaValueNode bindExpression(FromList fromList, SubqueryList subqueryList, java.util.Vector aggregateVector)
          Bind this expression.
 boolean categorize(JBitSet referencedTabs, boolean simplePredsOnly)
          Categorize this predicate.
 void generateExpression(ExpressionClassBuilder acb, MethodBuilder mb)
          General logic shared by Core compilation and by the Replication Filter compiler.
protected  int getOrderableVariantType()
          Return the variant type for the underlying expression.
 void init(java.lang.Object javaClassName, java.lang.Object fieldName, java.lang.Object classNameDelimitedIdentifier)
          Initializer for a StaticClassFieldReferenceNode
 void preprocess(int numTables, FromList outerFromList, SubqueryList outerSubqueryList, PredicateList outerPredicateList)
          Preprocess an expression tree.
 JavaValueNode remapColumnReferencesToExpressions()
          Remap all ColumnReferences in this tree to be clones of the underlying expression.
 
Methods inherited from class org.apache.derby.impl.sql.compile.JavaValueNode
castToPrimitive, checkReliability, generate, generateReceiver, generateReceiver, getCollationType, getConstantValueAsObject, getDataType, getJavaTypeName, getJSQLType, getPrimitiveTypeName, getReceiverExpression, isPrimitiveType, mapToTypeID, markForCallStatement, markReturnValueDiscarded, mustCastToPrimitive, returnValueDiscarded, returnValueToSQLDomain, setCollationType, setJavaTypeName, valueReturnedToSQLDomain
 
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
accept, acceptChildren, bindOffsetFetch, bindRowMultiSet, bindUserType, checkReliability, checkReliability, convertDefaultNode, createTypeDependency, debugFlush, debugPrint, disablePrivilegeCollection, formatNodeString, foundString, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContextManager, getCursorInfo, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getNodeFactory, getNodeType, getNullNode, getParameterTypes, getRowEstimate, getSchemaDescriptor, getSchemaDescriptor, getStatementType, getTableDescriptor, getTypeCompiler, init, init, init, init, init, init, init, init, init, init, init, init, init, isAtomic, isInstanceOf, isPrivilegeCollectionRequired, isSessionSchema, isSessionSchema, makeConstantAction, makeTableName, makeTableName, nodeHeader, orReliability, parseStatement, printLabel, printSubNodes, referencesSessionSchema, resolveTableToSynonym, setBeginOffset, setContextManager, setEndOffset, setNodeType, setRefActionInfo, stackPrint, toString, treePrint, treePrint, verifyClassExist
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fieldName

private java.lang.String fieldName

javaClassName

private java.lang.String javaClassName

classNameDelimitedIdentifier

private boolean classNameDelimitedIdentifier

field

private java.lang.reflect.Member field
The field we are going to access.

Constructor Detail

StaticClassFieldReferenceNode

public StaticClassFieldReferenceNode()
Method Detail

init

public void init(java.lang.Object javaClassName,
                 java.lang.Object fieldName,
                 java.lang.Object classNameDelimitedIdentifier)
Initializer for a StaticClassFieldReferenceNode

Overrides:
init in class QueryTreeNode
Parameters:
javaClassName - The class name
fieldName - The field name

bindExpression

public JavaValueNode bindExpression(FromList fromList,
                                    SubqueryList subqueryList,
                                    java.util.Vector aggregateVector)
                             throws StandardException
Bind this expression. This means binding the sub-expressions, as well as figuring out what the return type is for this expression.

Specified by:
bindExpression in class JavaValueNode
Parameters:
fromList - The FROM list for the query this expression is in, for binding columns.
subqueryList - The subquery list being built as we find SubqueryNodes
aggregateVector - The aggregate vector being built as we find AggregateNodes
Returns:
Nothing
Throws:
StandardException - Thrown on error
See Also:
ValueNode.bindExpression(org.apache.derby.impl.sql.compile.FromList, org.apache.derby.impl.sql.compile.SubqueryList, java.util.Vector)

preprocess

public void preprocess(int numTables,
                       FromList outerFromList,
                       SubqueryList outerSubqueryList,
                       PredicateList outerPredicateList)
                throws StandardException
Preprocess an expression tree. We do a number of transformations here (including subqueries, IN lists, LIKE and BETWEEN) plus subquery flattening. NOTE: This is done before the outer ResultSetNode is preprocessed.

Specified by:
preprocess in class JavaValueNode
Parameters:
numTables - Number of tables in the DML Statement
outerFromList - FromList from outer query block
outerSubqueryList - SubqueryList from outer query block
outerPredicateList - PredicateList from outer query block
Throws:
StandardException - Thrown on error
See Also:
ValueNode.preprocess(int, org.apache.derby.impl.sql.compile.FromList, org.apache.derby.impl.sql.compile.SubqueryList, org.apache.derby.impl.sql.compile.PredicateList)

categorize

public boolean categorize(JBitSet referencedTabs,
                          boolean simplePredsOnly)
Categorize this predicate. Initially, this means building a bit map of the referenced tables for each predicate. If the source of this ColumnReference (at the next underlying level) is not a ColumnReference or a VirtualColumnNode then this predicate will not be pushed down. For example, in: select * from (select 1 from s) a (x) where x = 1 we will not push down x = 1. NOTE: It would be easy to handle the case of a constant, but if the inner SELECT returns an arbitrary expression, then we would have to copy that tree into the pushed predicate, and that tree could contain subqueries and method calls. RESOLVE - revisit this issue once we have views.

Specified by:
categorize in class JavaValueNode
Parameters:
referencedTabs - JBitSet with bit map of referenced FromTables
simplePredsOnly - Whether or not to consider method calls, field references and conditional nodes when building bit map
Returns:
boolean Whether or not source.expression is a ColumnReference or a VirtualColumnNode.
See Also:
ValueNode.categorize(org.apache.derby.iapi.util.JBitSet, boolean)

remapColumnReferencesToExpressions

public JavaValueNode remapColumnReferencesToExpressions()
                                                 throws StandardException
Remap all ColumnReferences in this tree to be clones of the underlying expression.

Specified by:
remapColumnReferencesToExpressions in class JavaValueNode
Returns:
JavaValueNode The remapped expression tree.
Throws:
StandardException - Thrown on error
See Also:
ValueNode.remapColumnReferencesToExpressions()

getOrderableVariantType

protected int getOrderableVariantType()
Return the variant type for the underlying expression. The variant type can be: VARIANT - variant within a scan (method calls and non-static field access) SCAN_INVARIANT - invariant within a scan (column references from outer tables) QUERY_INVARIANT - invariant within the life of a query CONSTANT - constant

Overrides:
getOrderableVariantType in class JavaValueNode
Returns:
The variant type for the underlying expression.

generateExpression

public void generateExpression(ExpressionClassBuilder acb,
                               MethodBuilder mb)
                        throws StandardException
Description copied from class: JavaValueNode
General logic shared by Core compilation and by the Replication Filter compiler. Every child of ValueNode must implement one of these methods.

Specified by:
generateExpression in class JavaValueNode
Parameters:
acb - The ExpressionClassBuilder for the class being built
mb - the method the expression will go into
Throws:
StandardException - Thrown on error
See Also:
QueryTreeNode.generate(org.apache.derby.impl.sql.compile.ActivationClassBuilder, org.apache.derby.iapi.services.compiler.MethodBuilder)

Built on Thu 2011-03-10 11:54:14+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.