|
||||||||||
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
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
|
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()". |
CompilerContext |
myCompCtx
|
protected int |
nextExprNum
|
protected int |
nextFieldNum
|
protected int |
nextNonFastExpr
|
protected MethodBuilder |
resultSetClosedMethod
|
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 | |
FormatableArrayHolder |
addColumnToOrdering(FormatableArrayHolder orderingHolder,
int columnNum)
Add a column to the existing Ordering list. |
int |
addItem(java.lang.Object o)
|
private void |
addNewArrayOfRows(int numResultSets)
Generate the assignment for row = new ExecRow[numResultSets] |
private void |
beginConstructor()
|
abstract MethodBuilder |
beginExecuteMethod()
Build boiler plate for the Execute method |
void |
finishConstructor()
Finish the constructor by newing the array of Rows and putting a return at the end of it. |
abstract void |
finishExecuteMethod(boolean genMarkAsTopNode)
Finish up the Execute method. |
void |
generateDataValue(MethodBuilder mb,
TypeCompiler tc,
LocalField field)
Generate a data value. |
void |
generateNull(MethodBuilder mb,
TypeCompiler tc)
Generate a Null data value. |
void |
generateNullWithExpress(MethodBuilder mb,
TypeCompiler tc)
Generate a Null data value. |
abstract java.lang.String |
getBaseClassName()
Return the base class of the activation's hierarchy (the subclass of Object). |
ClassBuilder |
getClassBuilder()
|
FormatableArrayHolder |
getColumnOrdering(OrderedColumnList oclist)
|
FormatableArrayHolder |
getColumnOrdering(ResultColumnList rclist)
These utility methods buffers compilation from the IndexColumnOrder class. |
MethodBuilder |
getConstructor()
|
void |
getCurrentDateExpression(MethodBuilder mb)
This utility method returns an expression for CURRENT_DATE. |
protected LocalField |
getCurrentSetup()
|
void |
getCurrentTimeExpression(MethodBuilder mb)
This utility method returns an expression for CURRENT_TIME. |
void |
getCurrentTimestampExpression(MethodBuilder mb)
This utility method generates an expression for CURRENT_TIMESTAMP. |
MethodBuilder |
getExecuteMethod()
The execute method returns a result set that will evaluate the statement this activation class is the compiled form of. |
GeneratedClass |
getGeneratedClass(ByteArray savedBytes)
Take the generated class, and turn it into an actual class. |
abstract java.lang.String |
getPackageName()
Get the name of the package that the generated class will live in. |
abstract void |
getParameterReference(java.lang.String name,
int position,
DataTypeDescriptor dataType,
MethodBuilder mb)
Generates an expression to refer to a named parameter. |
abstract int |
getRowCount()
Get the number of ExecRows that must be allocated |
java.lang.String |
getRowLocationScanResultSetName()
|
protected TypeCompiler |
getTypeCompiler(TypeId typeId)
Get the TypeCompiler associated with the given TypeId |
MethodBuilder |
newExprFun()
"ExprFun"s are the "expression functions" that are specific to a given JSQL statement. |
LocalField |
newFieldDeclaration(int modifiers,
java.lang.String type)
Add an arbitrarily named field to the generated class. |
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. |
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. |
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)
|
java.lang.String |
newRowLocationScanResultSetName()
generates a variable name for the rowscanresultset. |
MethodBuilder |
newUserExprFun()
Start a user expression. |
void |
pushColumnReference(MethodBuilder mb,
int rsNumber,
int colId)
Generate a reference to a colunm in a result set. |
void |
pushDataValueFactory(MethodBuilder mb)
|
void |
pushGetExecutionFactoryExpression(MethodBuilder mb)
|
void |
pushGetResultSetFactoryExpression(MethodBuilder mb)
|
void |
pushMethodReference(MethodBuilder mb,
MethodBuilder exprMethod)
Push an expression that is a GeneratedMethod reference to the passed in method. aka. a "function pointer". |
void |
pushPVSReference(MethodBuilder mb)
Generate a reference to the parameter value set that all activations use. |
void |
pushResultSetClosedMethodFieldAccess(MethodBuilder mb)
This utility method returns the resultSetClosed method reference that the activation wants called when a result set closes, to let it clean up. |
void |
pushThisAsActivation(MethodBuilder mb)
Get a "this" expression declared as an Activation. |
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
public CompilerContext myCompCtx
public MethodBuilder executeMethod
protected LocalField cdtField
protected MethodBuilder resultSetClosedMethod
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 |
public 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 |
public abstract java.lang.String getPackageName()
public abstract int getRowCount() throws StandardException
StandardException
- thrown on failurepublic abstract void setNumSubqueries() throws StandardException
StandardException
- thrown on failurepublic abstract void getParameterReference(java.lang.String name, int position, DataTypeDescriptor dataType, MethodBuilder mb) throws StandardException
name
- Parameter nameposition
- Parameter numberdataType
- Parameter datatypemb
- The method to put the generated code into
StandardException
- thrown on failurepublic abstract MethodBuilder beginExecuteMethod() throws StandardException
StandardException
- thrown on failurepublic abstract void finishExecuteMethod(boolean genMarkAsTopNode) throws StandardException
StandardException
- thrown on failurepublic abstract java.lang.String getBaseClassName()
public MethodBuilder getConstructor()
public ClassBuilder getClassBuilder()
public MethodBuilder getExecuteMethod()
private final void beginConstructor()
public void finishConstructor() throws StandardException
StandardException
- thrown on failureprivate void addNewArrayOfRows(int numResultSets)
numResultSets
- The size of the array.
public 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.
public 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.
public 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()
public 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)
public 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.
public void pushMethodReference(MethodBuilder mb, MethodBuilder exprMethod)
public MethodBuilder newUserExprFun()
public void getCurrentDateExpression(MethodBuilder mb)
public void getCurrentTimeExpression(MethodBuilder mb)
public void getCurrentTimestampExpression(MethodBuilder mb)
public FormatableArrayHolder getColumnOrdering(ResultColumnList rclist)
public FormatableArrayHolder addColumnToOrdering(FormatableArrayHolder orderingHolder, int columnNum)
public FormatableArrayHolder getColumnOrdering(OrderedColumnList oclist)
public int addItem(java.lang.Object o)
public void pushDataValueFactory(MethodBuilder mb)
public void pushGetResultSetFactoryExpression(MethodBuilder mb)
public void pushGetExecutionFactoryExpression(MethodBuilder mb)
public void pushResultSetClosedMethodFieldAccess(MethodBuilder mb)
public void pushColumnReference(MethodBuilder mb, int rsNumber, int colId)
rsNumber
- the result set numbercolId
- the column number
public void pushPVSReference(MethodBuilder mb)
protected LocalField getCurrentSetup()
private java.lang.String newFieldName()
protected TypeCompiler getTypeCompiler(TypeId typeId)
typeId
- The TypeId to get a TypeCompiler for
public 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 occurspublic void pushThisAsActivation(MethodBuilder mb)
public void generateNull(MethodBuilder mb, TypeCompiler tc)
public void generateNullWithExpress(MethodBuilder mb, TypeCompiler tc)
public void generateDataValue(MethodBuilder mb, TypeCompiler tc, LocalField field)
public java.lang.String newRowLocationScanResultSetName()
public java.lang.String getRowLocationScanResultSetName()
|
Built on Mon 2007-06-04 09:58:47+0400, from revision ??? | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |