|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.impl.sql.compile.ExpressionClassBuilder
abstract class ExpressionClassBuilder
ExpressionClassBuilder provides an interface to satisfy generation's common tasks in building classes that involve expressions. This is the common superclass of ActivationClassBuilder and FilterClassBuilder. See the documentation on ActivationClassBuilder.
Field Summary | |
---|---|
protected ClassBuilder |
cb
|
protected LocalField |
cdtField
|
protected MethodBuilder |
constructor
|
protected static java.lang.String |
currentDatetimeFieldName
|
private java.lang.String |
currentRowScanResultSetName
|
(package private) MethodBuilder |
executeMethod
|
protected GeneratedClass |
gc
|
private java.lang.Object |
getDVF
Get/reuse the Expression for getting the DataValueFactory |
private java.lang.Object |
getEF
This is a utility method to get a common expression -- "BaseActivation.getExecutionFactory()". |
private java.lang.Object |
getRSF
This is a utility method to get a common expression -- "BaseActivation.getResultSetFactory()". |
(package private) CompilerContext |
myCompCtx
|
protected int |
nextExprNum
|
protected int |
nextFieldNum
|
protected int |
nextNonFastExpr
|
Constructor Summary | |
---|---|
ExpressionClassBuilder(java.lang.String superClass,
java.lang.String className,
CompilerContext cc)
By the time this is done, it has constructed the following class: public class #className extends #superClass { public #className() { super(); } } |
Method Summary | |
---|---|
(package private) FormatableArrayHolder |
addColumnToOrdering(FormatableArrayHolder orderingHolder,
int columnNum)
Add a column to the existing Ordering list. |
(package private) int |
addItem(java.lang.Object o)
|
private void |
addNewArrayOfRows(int numResultSets)
Generate the assignment for row = new ExecRow[numResultSets] |
private void |
beginConstructor()
|
(package private) void |
finishConstructor()
Finish the constructor by newing the array of Rows and putting a return at the end of it. |
(package private) void |
generateDataValue(MethodBuilder mb,
TypeCompiler tc,
int collationType,
LocalField field)
Generate a data value. |
(package private) void |
generateNull(MethodBuilder mb,
TypeCompiler tc,
int collationType)
Generate a Null data value. |
(package private) void |
generateNullWithExpress(MethodBuilder mb,
TypeCompiler tc,
int collationType)
Generate a Null data value. |
(package private) abstract java.lang.String |
getBaseClassName()
Return the base class of the activation's hierarchy (the subclass of Object). |
(package private) ClassBuilder |
getClassBuilder()
|
(package private) FormatableArrayHolder |
getColumnOrdering(OrderedColumnList oclist)
|
(package private) FormatableArrayHolder |
getColumnOrdering(ResultColumnList rclist)
These utility methods buffers compilation from the IndexColumnOrder class. |
(package private) MethodBuilder |
getConstructor()
|
(package private) void |
getCurrentDateExpression(MethodBuilder mb)
This utility method returns an expression for CURRENT_DATE. |
protected LocalField |
getCurrentSetup()
|
(package private) void |
getCurrentTimeExpression(MethodBuilder mb)
This utility method returns an expression for CURRENT_TIME. |
(package private) void |
getCurrentTimestampExpression(MethodBuilder mb)
This utility method generates an expression for CURRENT_TIMESTAMP. |
(package private) MethodBuilder |
getExecuteMethod()
Get the execute method in order to add code to it. |
(package private) GeneratedClass |
getGeneratedClass(ByteArray savedBytes)
Take the generated class, and turn it into an actual class. |
(package private) abstract java.lang.String |
getPackageName()
Get the name of the package that the generated class will live in. |
(package private) abstract int |
getRowCount()
Get the number of ExecRows that must be allocated |
(package private) java.lang.String |
getRowLocationScanResultSetName()
|
protected TypeCompiler |
getTypeCompiler(TypeId typeId)
Get the TypeCompiler associated with the given TypeId |
(package private) MethodBuilder |
newExprFun()
"ExprFun"s are the "expression functions" that are specific to a given JSQL statement. |
(package private) LocalField |
newFieldDeclaration(int modifiers,
java.lang.String type)
Add an arbitrarily named field to the generated class. |
(package private) LocalField |
newFieldDeclaration(int modifiers,
java.lang.String type,
java.lang.String name)
Add a field declaration to the generated class |
private java.lang.String |
newFieldName()
generated the next field name available. |
(package private) MethodBuilder |
newGeneratedFun(java.lang.String returnType,
int modifiers)
Activations might have need of internal functions that are not used by the result sets, but by other activation functions. |
(package private) MethodBuilder |
newGeneratedFun(java.lang.String returnType,
int modifiers,
java.lang.String[] params)
|
private MethodBuilder |
newGeneratedFun(java.lang.String exprName,
java.lang.String returnType,
int modifiers,
java.lang.String[] params)
|
(package private) java.lang.String |
newRowLocationScanResultSetName()
generates a variable name for the rowscanresultset. |
(package private) MethodBuilder |
newUserExprFun()
Start a user expression. |
(package private) void |
pushColumnReference(MethodBuilder mb,
int rsNumber,
int colId)
Generate a reference to a colunm in a result set. |
(package private) void |
pushDataValueFactory(MethodBuilder mb)
|
(package private) void |
pushGetExecutionFactoryExpression(MethodBuilder mb)
|
(package private) void |
pushGetResultSetFactoryExpression(MethodBuilder mb)
|
(package private) void |
pushMethodReference(MethodBuilder mb,
MethodBuilder exprMethod)
Push an expression that is a GeneratedMethod reference to the passed in method. aka. a "function pointer". |
(package private) void |
pushPVSReference(MethodBuilder mb)
Generate a reference to the parameter value set that all activations use. |
(package private) void |
pushThisAsActivation(MethodBuilder mb)
Get a "this" expression declared as an Activation. |
(package private) abstract void |
setNumSubqueries()
Sets the number of subqueries under this expression |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String currentDatetimeFieldName
protected ClassBuilder cb
protected GeneratedClass gc
protected int nextExprNum
protected int nextNonFastExpr
protected int nextFieldNum
protected MethodBuilder constructor
CompilerContext myCompCtx
MethodBuilder executeMethod
protected LocalField cdtField
private java.lang.String currentRowScanResultSetName
private java.lang.Object getDVF
private java.lang.Object getRSF
BaseActivation gets the factory from the context and caches it for faster retrieval.
private java.lang.Object getEF
BaseActivation gets the factory from the context and caches it for faster retrieval.
Constructor Detail |
---|
ExpressionClassBuilder(java.lang.String superClass, java.lang.String className, CompilerContext cc) throws StandardException
public class #className extends #superClass { public #className() { super(); } }
StandardException
- thrown on failureMethod Detail |
---|
abstract java.lang.String getPackageName()
abstract int getRowCount() throws StandardException
StandardException
- thrown on failureabstract void setNumSubqueries() throws StandardException
StandardException
- thrown on failureabstract java.lang.String getBaseClassName()
MethodBuilder getConstructor()
ClassBuilder getClassBuilder()
MethodBuilder getExecuteMethod()
private final void beginConstructor()
void finishConstructor() throws StandardException
StandardException
- thrown on failureprivate void addNewArrayOfRows(int numResultSets)
numResultSets
- The size of the array.LocalField newFieldDeclaration(int modifiers, java.lang.String type, java.lang.String name)
modifiers
- The | of the modifier values such as public, static, etc.type
- The type of the field in java language.name
- The name of the field.
LocalField newFieldDeclaration(int modifiers, java.lang.String type)
modifiers
- The | of the modifier values such as public, static, etc.type
- The type of the field in java language.
MethodBuilder newGeneratedFun(java.lang.String returnType, int modifiers)
The generated function will generally have a generated name that can be viewed through the MethodBuilder interface. This name is generated to ensure uniqueness from other function names in the activation class. If you pass in a function name, think carefully about whether it will collide with other names.
returnType
- the return type of the functionmodifiers
- the modifiers on the functionnewExprFun()
MethodBuilder newGeneratedFun(java.lang.String returnType, int modifiers, java.lang.String[] params)
private MethodBuilder newGeneratedFun(java.lang.String exprName, java.lang.String returnType, int modifiers, java.lang.String[] params)
MethodBuilder newExprFun()
All methods return by this are expected to be called via the GeneratedMethod interface. Thus the methods are public and return java.lang.Object.
Once the exprfun has been created, the caller will need to add statements to it, minimally a return statement.
ExprFuns return Object types, since they are invoked through reflection and thus their return type would get wrapped in an object anyway. For example: return java.lang.Boolean, not boolean.
void pushMethodReference(MethodBuilder mb, MethodBuilder exprMethod)
MethodBuilder newUserExprFun()
void getCurrentDateExpression(MethodBuilder mb)
void getCurrentTimeExpression(MethodBuilder mb)
void getCurrentTimestampExpression(MethodBuilder mb)
FormatableArrayHolder getColumnOrdering(ResultColumnList rclist)
FormatableArrayHolder addColumnToOrdering(FormatableArrayHolder orderingHolder, int columnNum)
FormatableArrayHolder getColumnOrdering(OrderedColumnList oclist)
int addItem(java.lang.Object o)
void pushDataValueFactory(MethodBuilder mb)
void pushGetResultSetFactoryExpression(MethodBuilder mb)
void pushGetExecutionFactoryExpression(MethodBuilder mb)
void pushColumnReference(MethodBuilder mb, int rsNumber, int colId)
rsNumber
- the result set numbercolId
- the column numbervoid pushPVSReference(MethodBuilder mb)
protected LocalField getCurrentSetup()
private java.lang.String newFieldName()
protected TypeCompiler getTypeCompiler(TypeId typeId)
typeId
- The TypeId to get a TypeCompiler for
GeneratedClass getGeneratedClass(ByteArray savedBytes) throws StandardException
This method assumes, does not check, that the class and its parts are all complete.
savedBytes
- place to save generated bytes.
if null, it is ignored
StandardException
- thrown when exception occursvoid pushThisAsActivation(MethodBuilder mb)
void generateNull(MethodBuilder mb, TypeCompiler tc, int collationType)
void generateNullWithExpress(MethodBuilder mb, TypeCompiler tc, int collationType)
void generateDataValue(MethodBuilder mb, TypeCompiler tc, int collationType, LocalField field)
java.lang.String newRowLocationScanResultSetName()
java.lang.String getRowLocationScanResultSetName()
|
Built on Thu 2011-03-10 11:54:14+0000, from revision ??? | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |