Java Doc for Compiler.java in  » Template-Engine » Tea » com » go » tea » compiler » 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 » Template Engine » Tea » com.go.tea.compiler 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.go.tea.compiler.Compiler

Compiler
abstract public class Compiler (Code)
The Tea compiler. This class is abstract, and a few concrete implementations can be found in the com.go.tea.util package.

A Compiler instance should be used for only one "build" because some information is cached internally like parse trees and error count.
author:
   Brian S O'Neill
version:
   58 , 7/26/01
See Also:   com.go.tea.util.FileCompiler
See Also:   com.go.tea.util.ResourceCompiler



Field Summary
final  MapmParseTreeMap
    

Constructor Summary
public  Compiler()
    
public  Compiler(Map parseTreeMap)
     This constructor allows template signatures to be shared among compiler instances.

Method Summary
public  voidaddErrorListener(ErrorListener listener)
     Add an ErrorListener in order receive events of compile-time errors.
public  voidaddStatusListener(StatusListener listener)
     Add a StatusListener in order to receive events of compilation progress.
public  String[]compile(String name)
     Compile a single compilation unit.
public  String[]compile(String[] names)
     Compile a list of compilation units.
protected  CodeGeneratorcreateCodeGenerator(CompilationUnit unit)
     Default implementation returns a new JavaClassGenerator.
abstract protected  CompilationUnitcreateCompilationUnit(String name)
    
protected  ParsercreateParser(Scanner scanner, CompilationUnit unit)
    
protected  ScannercreateScanner(SourceReader reader, CompilationUnit unit)
    
protected  SourceReadercreateSourceReader(CompilationUnit unit)
     Default implementation returns a SourceReader that uses "<%" and "%>" as code delimiters.
protected  TypeCheckercreateTypeChecker(CompilationUnit unit)
    
public  ClassLoadergetClassLoader()
     Returns the ClassLoader used by the Compiler, or null if none set.
public  CompilationUnitgetCompilationUnit(String name, CompilationUnit from)
     Returns a compilation unit associated with the given name, or null if not found.
public  intgetErrorCount()
    
final public static  String[]getImportedPackages()
     Returns the list of imported packages that all templates have.
 TemplategetParseTree(CompilationUnit unit)
     Called by the Compiler or by a CompilationUnit when its parse tree is requested.
public  ClassgetRuntimeContext()
     Return a class that defines a template's runtime context.
final public  Method[]getRuntimeContextMethods()
     Returns all the methods available in the runtime context.
public  StringgetRuntimeReceiver()
     Return the name of a method in the runtime context to bind to for receiving objects emitted by templates.
public  StringgetRuntimeStringConverter()
     Return the name of a method in the runtime context to bind to for converting objects and primitives to strings.
final public  Method[]getStringConverterMethods()
     Returns the set of methods that are used to perform conversion to strings.
public  booleanisCodeGenerationEnabled()
     Returns true if code generation is enabled.
public  booleanisExceptionGuardianEnabled()
     Returns true if the exception guardian is enabled.
public  ClassloadClass(String name)
     Loads and returns a class by the fully qualified name given.
public  voidpreserveParseTree(String name)
     After a template is compiled, all but the root node of its parse tree is clipped, in order to save memory.
public  voidremoveErrorListener(ErrorListener listener)
    
public  voidremoveStatusListener(StatusListener listener)
    
public  voidsetClassLoader(ClassLoader loader)
     Sets the ClassLoader to use to load classes with.
public  voidsetCodeGenerationEnabled(boolean flag)
     By default, code generation is enabled.
public  voidsetExceptionGuardianEnabled(boolean flag)
    
public  voidsetRuntimeContext(Class contextClass)
     Call to override the default runtime context class that a template is compiled to use.
abstract public  booleansourceExists(String name)
    

Field Detail
mParseTreeMap
final Map mParseTreeMap(Code)




Constructor Detail
Compiler
public Compiler()(Code)



Compiler
public Compiler(Map parseTreeMap)(Code)
This constructor allows template signatures to be shared among compiler instances. This is useful in interactive environments, where compilation is occurring on a regular basis, but most called templates are not being modified. The Compiler will map qualified template names to ParseTree objects that have their code removed. Removing a template entry from the map will force the compiler to re-parse the template if it is called. Any template passed into the compile method will always be re-parsed, even if its parse tree is already present in the map.
Parameters:
  parseTreeMap - map should be thread-safe




Method Detail
addErrorListener
public void addErrorListener(ErrorListener listener)(Code)
Add an ErrorListener in order receive events of compile-time errors.
See Also:   com.go.tea.util.ConsoleErrorReporter



addStatusListener
public void addStatusListener(StatusListener listener)(Code)
Add a StatusListener in order to receive events of compilation progress.



compile
public String[] compile(String name) throws IOException(Code)
Compile a single compilation unit. This method can be called multiple times, but it will not compile compilation units that have already been compiled.
Parameters:
  name - the fully qualified template name The names of all the sources compiled by this compiler
exception:
  IOException -



compile
public String[] compile(String[] names) throws IOException(Code)
Compile a list of compilation units. This method can be called multiple times, but it will not compile compilation units that have already been compiled.
Parameters:
  names - an array of fully qualified template names The names of all the sources compiled by this compiler
exception:
  IOException -



createCodeGenerator
protected CodeGenerator createCodeGenerator(CompilationUnit unit) throws IOException(Code)
Default implementation returns a new JavaClassGenerator.
See Also:   JavaClassGenerator



createCompilationUnit
abstract protected CompilationUnit createCompilationUnit(String name)(Code)



createParser
protected Parser createParser(Scanner scanner, CompilationUnit unit) throws IOException(Code)



createScanner
protected Scanner createScanner(SourceReader reader, CompilationUnit unit) throws IOException(Code)



createSourceReader
protected SourceReader createSourceReader(CompilationUnit unit) throws IOException(Code)
Default implementation returns a SourceReader that uses "<%" and "%>" as code delimiters.



createTypeChecker
protected TypeChecker createTypeChecker(CompilationUnit unit)(Code)



getClassLoader
public ClassLoader getClassLoader()(Code)
Returns the ClassLoader used by the Compiler, or null if none set.



getCompilationUnit
public CompilationUnit getCompilationUnit(String name, CompilationUnit from)(Code)
Returns a compilation unit associated with the given name, or null if not found.
Parameters:
  name - the requested name
Parameters:
  from - optional CompilationUnit is passed because requested nameshould be found relative to it.



getErrorCount
public int getErrorCount()(Code)



getImportedPackages
final public static String[] getImportedPackages()(Code)
Returns the list of imported packages that all templates have. This always returns "java.lang" and "java.util". Template parameters can abbreviate the names of all classes in java.lang and java.util.



getParseTree
Template getParseTree(CompilationUnit unit)(Code)
Called by the Compiler or by a CompilationUnit when its parse tree is requested. Requesting a parse tree may cause template code to be generated.



getRuntimeContext
public Class getRuntimeContext()(Code)
Return a class that defines a template's runtime context. The runtime context contains methods that are callable by templates. A template is compiled such that the first parameter of its execute method must be an instance of the runtime context.

Default implementation returns com.go.tea.runtime.UtilityContext.
See Also:   com.go.tea.runtime.UtilityContext




getRuntimeContextMethods
final public Method[] getRuntimeContextMethods()(Code)
Returns all the methods available in the runtime context.



getRuntimeReceiver
public String getRuntimeReceiver()(Code)
Return the name of a method in the runtime context to bind to for receiving objects emitted by templates. The compiler will bind to the closest matching public method based on the type of its single parameter.

Default implementation returns "print".




getRuntimeStringConverter
public String getRuntimeStringConverter()(Code)
Return the name of a method in the runtime context to bind to for converting objects and primitives to strings. The compiler will bind to the closest matching public method based on the type of its single parameter.

Default implementation returns "toString". Returning null indicates that a static String.valueOf method should be invoked.




getStringConverterMethods
final public Method[] getStringConverterMethods()(Code)
Returns the set of methods that are used to perform conversion to strings. The compiler will bind to the closest matching method based on its parameter type.



isCodeGenerationEnabled
public boolean isCodeGenerationEnabled()(Code)
Returns true if code generation is enabled. The default setting is true.



isExceptionGuardianEnabled
public boolean isExceptionGuardianEnabled()(Code)
Returns true if the exception guardian is enabled. The default setting is false.



loadClass
public Class loadClass(String name) throws ClassNotFoundException(Code)
Loads and returns a class by the fully qualified name given. If a ClassLoader is specified, it is used to load the class. Otherwise, the class is loaded via Class.forName.
See Also:   Compiler.setClassLoader(ClassLoader)



preserveParseTree
public void preserveParseTree(String name)(Code)
After a template is compiled, all but the root node of its parse tree is clipped, in order to save memory. Applications that wish to traverse CompilationUnit parse trees should call this method to preserve them. This method must be called prior to compilation and prior to requesting a parse tree from a CompilationUnit.
Parameters:
  name - fully qualified name of template whose parse tree is to bepreserved.



removeErrorListener
public void removeErrorListener(ErrorListener listener)(Code)



removeStatusListener
public void removeStatusListener(StatusListener listener)(Code)



setClassLoader
public void setClassLoader(ClassLoader loader)(Code)
Sets the ClassLoader to use to load classes with. If set to null, then classes are loaded using Class.forName.



setCodeGenerationEnabled
public void setCodeGenerationEnabled(boolean flag)(Code)
By default, code generation is enabled. Passing false disables the code generation phase of the compiler.



setExceptionGuardianEnabled
public void setExceptionGuardianEnabled(boolean flag)(Code)



setRuntimeContext
public void setRuntimeContext(Class contextClass)(Code)
Call to override the default runtime context class that a template is compiled to use.
See Also:   com.go.tea.runtime.Context



sourceExists
abstract public boolean sourceExists(String name)(Code)
true if source exists for the given qualified name



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.