Java Doc for ExpressionClassBuilder.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » impl » sql » compile » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db derby 10.2 » org.apache.derby.impl.sql.compile 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.derby.impl.sql.compile.ExpressionClassBuilder

All known Subclasses:   org.apache.derby.impl.sql.compile.ActivationClassBuilder,
ExpressionClassBuilder
abstract class ExpressionClassBuilder implements ExpressionClassBuilderInterface(Code)
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.
author:
   Rick Extracted out of ActivationClassBuilder


Field Summary
protected  ClassBuildercb
    
protected  LocalFieldcdtField
    
protected  MethodBuilderconstructor
    
final protected static  StringcurrentDatetimeFieldName
    
 MethodBuilderexecuteMethod
    
protected  GeneratedClassgc
    
 CompilerContextmyCompCtx
    
protected  intnextExprNum
    
protected  intnextFieldNum
    
protected  intnextNonFastExpr
    

Constructor Summary
 ExpressionClassBuilder(String superClass, String className, CompilerContext cc)
    

Method Summary
 FormatableArrayHolderaddColumnToOrdering(FormatableArrayHolder orderingHolder, int columnNum)
     Add a column to the existing Ordering list.
 intaddItem(Object o)
    
abstract  MethodBuilderbeginExecuteMethod()
    
 voidfinishConstructor()
     Finish the constructor by newing the array of Rows and putting a return at the end of it.
abstract  voidfinishExecuteMethod(boolean genMarkAsTopNode)
     Finish up the Execute method.
 voidgenerateDataValue(MethodBuilder mb, TypeCompiler tc, LocalField field)
     Generate a data value.
 voidgenerateNull(MethodBuilder mb, TypeCompiler tc)
     Generate a Null data value.
 voidgenerateNullWithExpress(MethodBuilder mb, TypeCompiler tc)
     Generate a Null data value.
abstract  StringgetBaseClassName()
     Return the base class of the activation's hierarchy (the subclass of Object). This class is expected to hold methods used by all compilation code, such as datatype compilation code, e.g.
 ClassBuildergetClassBuilder()
    
 FormatableArrayHoldergetColumnOrdering(ResultColumnList rclist)
     These utility methods buffers compilation from the IndexColumnOrder class.
 FormatableArrayHoldergetColumnOrdering(OrderedColumnList oclist)
    
 MethodBuildergetConstructor()
    
 voidgetCurrentDateExpression(MethodBuilder mb)
     This utility method returns an expression for CURRENT_DATE.
protected  LocalFieldgetCurrentSetup()
    
 voidgetCurrentTimeExpression(MethodBuilder mb)
     This utility method returns an expression for CURRENT_TIME.
 voidgetCurrentTimestampExpression(MethodBuilder mb)
     This utility method generates an expression for CURRENT_TIMESTAMP.
 MethodBuildergetExecuteMethod()
     The execute method returns a result set that will evaluate the statement this activation class is the compiled form of.
 GeneratedClassgetGeneratedClass(ByteArray savedBytes)
     Take the generated class, and turn it into an actual class.
abstract  StringgetPackageName()
     Get the name of the package that the generated class will live in.
abstract  intgetRowCount()
    
 StringgetRowLocationScanResultSetName()
    
protected  TypeCompilergetTypeCompiler(TypeId typeId)
    
 MethodBuildernewExprFun()
     "ExprFun"s are the "expression functions" that are specific to a given JSQL statement.
 LocalFieldnewFieldDeclaration(int modifiers, String type, String name)
     Add a field declaration to the generated class
Parameters:
  modifiers - The | of the modifier values such as public, static, etc.
Parameters:
  type - The type of the field in java language.
Parameters:
  name - The name of the field.
 LocalFieldnewFieldDeclaration(int modifiers, String type)
     Add an arbitrarily named field to the generated class. This is used to generate fields where the caller doesn't care what the field is named.
 MethodBuildernewGeneratedFun(String returnType, int modifiers)
     Activations might have need of internal functions that are not used by the result sets, but by other activation functions.
 MethodBuildernewGeneratedFun(String returnType, int modifiers, String[] params)
    
 StringnewRowLocationScanResultSetName()
     generates a variable name for the rowscanresultset.
 MethodBuildernewUserExprFun()
     Start a user expression.
 voidpushColumnReference(MethodBuilder mb, int rsNumber, int colId)
     Generate a reference to a colunm in a result set.
 voidpushDataValueFactory(MethodBuilder mb)
    
 voidpushGetExecutionFactoryExpression(MethodBuilder mb)
    
 voidpushGetResultSetFactoryExpression(MethodBuilder mb)
    
 voidpushMethodReference(MethodBuilder mb, MethodBuilder exprMethod)
     Push an expression that is a GeneratedMethod reference to the passed in method.
 voidpushPVSReference(MethodBuilder mb)
     Generate a reference to the parameter value set that all activations use.
 voidpushThisAsActivation(MethodBuilder mb)
     Get a "this" expression declared as an Activation.
abstract  voidsetNumSubqueries()
    

Field Detail
cb
protected ClassBuilder cb(Code)



cdtField
protected LocalField cdtField(Code)



constructor
protected MethodBuilder constructor(Code)



currentDatetimeFieldName
final protected static String currentDatetimeFieldName(Code)



executeMethod
MethodBuilder executeMethod(Code)



gc
protected GeneratedClass gc(Code)



myCompCtx
CompilerContext myCompCtx(Code)



nextExprNum
protected int nextExprNum(Code)



nextFieldNum
protected int nextFieldNum(Code)



nextNonFastExpr
protected int nextNonFastExpr(Code)




Constructor Detail
ExpressionClassBuilder
ExpressionClassBuilder(String superClass, String className, CompilerContext cc) throws StandardException(Code)
By the time this is done, it has constructed the following class:
 public class #className extends #superClass {
 public #className() { super(); }
 }
 

exception:
  StandardException - thrown on failure




Method Detail
addColumnToOrdering
FormatableArrayHolder addColumnToOrdering(FormatableArrayHolder orderingHolder, int columnNum)(Code)
Add a column to the existing Ordering list. Takes a column id and only adds it if it isn't in the list. the ColumnOrdering array



addItem
int addItem(Object o)(Code)



beginExecuteMethod
abstract MethodBuilder beginExecuteMethod() throws StandardException(Code)
Build boiler plate for the Execute method a method builder containing boiler plate for the Execute method
exception:
  StandardException - thrown on failure



finishConstructor
void finishConstructor() throws StandardException(Code)
Finish the constructor by newing the array of Rows and putting a return at the end of it.
exception:
  StandardException - thrown on failure



finishExecuteMethod
abstract void finishExecuteMethod(boolean genMarkAsTopNode) throws StandardException(Code)
Finish up the Execute method.
exception:
  StandardException - thrown on failure



generateDataValue
void generateDataValue(MethodBuilder mb, TypeCompiler tc, LocalField field)(Code)
Generate a data value. The value is to be set in the SQL data value is required on the stack and will be popped, a SQL data value is pushed.



generateNull
void generateNull(MethodBuilder mb, TypeCompiler tc)(Code)
Generate a Null data value. Nothing is required on the stack, a SQL null data value is pushed.



generateNullWithExpress
void generateNullWithExpress(MethodBuilder mb, TypeCompiler tc)(Code)
Generate a Null data value. The express value is required on the stack and will be popped, a SQL null data value is pushed.



getBaseClassName
abstract String getBaseClassName()(Code)
Return the base class of the activation's hierarchy (the subclass of Object). This class is expected to hold methods used by all compilation code, such as datatype compilation code, e.g. getDataValueFactory.



getClassBuilder
ClassBuilder getClassBuilder()(Code)



getColumnOrdering
FormatableArrayHolder getColumnOrdering(ResultColumnList rclist)(Code)
These utility methods buffers compilation from the IndexColumnOrder class. They create an ordering based on their parameter, stuff that into the prepared statement, and then return the entry # for use in the generated code. We could write another utility method to generate code to turn an entry # back into an object, but so far no-one needs it. WARNING: this is a crafty method that ASSUMES that you want every column in the list ordered, and that every column in the list is the entire actual result colunm. It is only useful for DISTINCT in select.



getColumnOrdering
FormatableArrayHolder getColumnOrdering(OrderedColumnList oclist)(Code)



getConstructor
MethodBuilder getConstructor()(Code)



getCurrentDateExpression
void getCurrentDateExpression(MethodBuilder mb)(Code)
This utility method returns an expression for CURRENT_DATE. Get the expression this way, because the activation needs to generate support information for CURRENT_DATE, that would otherwise be painful to create manually.



getCurrentSetup
protected LocalField getCurrentSetup()(Code)



getCurrentTimeExpression
void getCurrentTimeExpression(MethodBuilder mb)(Code)
This utility method returns an expression for CURRENT_TIME. Get the expression this way, because the activation needs to generate support information for CURRENT_TIME, that would otherwise be painful to create manually.



getCurrentTimestampExpression
void getCurrentTimestampExpression(MethodBuilder mb)(Code)
This utility method generates an expression for CURRENT_TIMESTAMP. Get the expression this way, because the activation needs to generate support information for CURRENT_TIMESTAMP, that would otherwise be painful to create manually.



getExecuteMethod
MethodBuilder getExecuteMethod()(Code)
The execute method returns a result set that will evaluate the statement this activation class is the compiled form of. REVISIT: do we need to give the caller the ability to touch it directly, or could we wrap the alterations to it in this class?



getGeneratedClass
GeneratedClass getGeneratedClass(ByteArray savedBytes) throws StandardException(Code)
Take the generated class, and turn it into an actual class.

This method assumes, does not check, that the class and its parts are all complete.
Parameters:
  savedBytes - place to save generated bytes.if null, it is ignored
exception:
  StandardException - thrown when exception occurs




getPackageName
abstract String getPackageName()(Code)
Get the name of the package that the generated class will live in. name of package that the generated class will live in.



getRowCount
abstract int getRowCount() throws StandardException(Code)
Get the number of ExecRows that must be allocated number of ExecRows that must be allocated
exception:
  StandardException - thrown on failure



getRowLocationScanResultSetName
String getRowLocationScanResultSetName()(Code)



getTypeCompiler
protected TypeCompiler getTypeCompiler(TypeId typeId)(Code)
Get the TypeCompiler associated with the given TypeId
Parameters:
  typeId - The TypeId to get a TypeCompiler for The corresponding TypeCompiler



newExprFun
MethodBuilder newExprFun()(Code)
"ExprFun"s are the "expression functions" that are specific to a given JSQL statement. For example, an ExprFun is generated to evaluate the where clause of a select statement and return a boolean result.

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.




newFieldDeclaration
LocalField newFieldDeclaration(int modifiers, String type, String name)(Code)
Add a field declaration to the generated class
Parameters:
  modifiers - The | of the modifier values such as public, static, etc.
Parameters:
  type - The type of the field in java language.
Parameters:
  name - The name of the field. None.



newFieldDeclaration
LocalField newFieldDeclaration(int modifiers, String type)(Code)
Add an arbitrarily named field to the generated class. This is used to generate fields where the caller doesn't care what the field is named. It is especially useful for generating arbitrary numbers of fields, where the caller doesn't know in advance how many fields will be used. For example, it is used for generating fields to hold intermediate values from expressions.
Parameters:
  modifiers - The | of the modifier values such as public, static, etc.
Parameters:
  type - The type of the field in java language. The name of the new field



newGeneratedFun
MethodBuilder newGeneratedFun(String returnType, int modifiers)(Code)
Activations might have need of internal functions that are not used by the result sets, but by other activation functions. Thus, we make it possible for functions to be generated directly as well as through the newExprFun interface. newExprFun should be used when a static field pointing to the expression function is needed.

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.
Parameters:
  returnType - the return type of the function
Parameters:
  modifiers - the modifiers on the function
See Also:   ExpressionClassBuilder.newExprFun




newGeneratedFun
MethodBuilder newGeneratedFun(String returnType, int modifiers, String[] params)(Code)



newRowLocationScanResultSetName
String newRowLocationScanResultSetName()(Code)
generates a variable name for the rowscanresultset. This can not be a fixed name because in cases like cascade delete same activation class will be dealing more than one RowScanResultSets for dependent tables.



newUserExprFun
MethodBuilder newUserExprFun()(Code)
Start a user expression. The difference between a normal expression (returned by newExprFun) and a user expression is that a user expression catches all exceptions (because we don't want random exceptions thrown from user methods to propagate to the rest of the system. A new MethodBuilder



pushColumnReference
void pushColumnReference(MethodBuilder mb, int rsNumber, int colId)(Code)
Generate a reference to a colunm in a result set.
Parameters:
  rsNumber - the result set number
Parameters:
  colId - the column number



pushDataValueFactory
void pushDataValueFactory(MethodBuilder mb)(Code)



pushGetExecutionFactoryExpression
void pushGetExecutionFactoryExpression(MethodBuilder mb)(Code)



pushGetResultSetFactoryExpression
void pushGetResultSetFactoryExpression(MethodBuilder mb)(Code)



pushMethodReference
void pushMethodReference(MethodBuilder mb, MethodBuilder exprMethod)(Code)
Push an expression that is a GeneratedMethod reference to the passed in method. aka. a "function pointer".



pushPVSReference
void pushPVSReference(MethodBuilder mb)(Code)
Generate a reference to the parameter value set that all activations use.



pushThisAsActivation
void pushThisAsActivation(MethodBuilder mb)(Code)
Get a "this" expression declared as an Activation. This is the commonly used type of the this expression.



setNumSubqueries
abstract void setNumSubqueries() throws StandardException(Code)
Sets the number of subqueries under this expression
exception:
  StandardException - thrown on failure



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.