Java Doc for SimpleCompiler.java in  » Scripting » janino-2.5.11 » org » codehaus » janino » 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 » Scripting » janino 2.5.11 » org.codehaus.janino 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.codehaus.janino.Cookable
      org.codehaus.janino.SimpleCompiler

All known Subclasses:   org.codehaus.janino.ClassBodyEvaluator,
SimpleCompiler
public class SimpleCompiler extends Cookable (Code)
A simplified version of Compiler that can compile only a single compilation unit. (A "compilation unit" is the characters stored in a ".java" file.)

Opposed to a normal ".java" file, you can declare multiple public classes here.

To set up a SimpleCompiler object, proceed as follows:

  1. Create the SimpleCompiler using SimpleCompiler.SimpleCompiler()
  2. Optionally set an alternate parent class loader through SimpleCompiler.setParentClassLoader(ClassLoader) .
  3. Call any of the org.codehaus.janino.Cookable.cook(Scanner) methods to scan, parse, compile and load the compilation unit into the JVM.
Alternatively, a number of "convenience constructors" exist that execute the steps described above instantly.


Field Summary
final public static  ClassLoaderBOOT_CLASS_LOADER
     A ClassLoader that finds the classes on the JVM's boot class path (e.g.

Constructor Summary
public  SimpleCompiler(String optionalFileName, Reader in)
    
public  SimpleCompiler(String optionalFileName, InputStream is)
    
public  SimpleCompiler(String fileName)
    
public  SimpleCompiler(Scanner scanner, ClassLoader optionalParentClassLoader)
    
public  SimpleCompiler()
    

Method Summary
protected  Java.TypeclassToType(Location location, Class optionalClass)
     Wrap a reflection Class in a Java.Type object.
protected  Java.Type[]classesToTypes(Location location, Class[] classes)
     Convert an array of Class es into an array of Java.Type s.
final protected  ClassLoadercompileToClassLoader(Java.CompilationUnit compilationUnit, EnumeratorSet debuggingInformation)
     Compile the given compilation unit.
public  voidcook(Scanner scanner)
    
public  booleanequals(Object o)
     Two SimpleCompiler s are regarded equal iff
  • Both are objects of the same class (e.g.
public  ClassLoadergetClassLoader()
     Returns a ClassLoader object through which the previously compiled classes can be accessed.
public  inthashCode()
    
public static  voidmain(String[] args)
    
public  voidsetParentClassLoader(ClassLoader optionalParentClassLoader)
     The "parent class loader" is used to load referenced classes.
public  voidsetParentClassLoader(ClassLoader optionalParentClassLoader, Class[] auxiliaryClasses)
     Allowe references to the classes loaded through this parent class loader (@see SimpleCompiler.setParentClassLoader(ClassLoader) ), plus the extra auxiliaryClasses.
final protected  voidsetUpClassLoaders()
     Initializes SimpleCompiler.classLoader and SimpleCompiler.iClassLoader from the configured SimpleCompiler.parentClassLoader and SimpleCompiler.optionalAuxiliaryClasses .

Field Detail
BOOT_CLASS_LOADER
final public static ClassLoader BOOT_CLASS_LOADER(Code)
A ClassLoader that finds the classes on the JVM's boot class path (e.g. java.io.*), but not the classes on the JVM's class path.




Constructor Detail
SimpleCompiler
public SimpleCompiler(String optionalFileName, Reader in) throws IOException, Scanner.ScanException, Parser.ParseException, CompileException(Code)
Equivalent to
 SimpleCompiler sc = new SimpleCompiler();
 sc.cook(optionalFileName, in);

See Also:   SimpleCompiler.SimpleCompiler()
See Also:   Cookable.cook(StringReader)



SimpleCompiler
public SimpleCompiler(String optionalFileName, InputStream is) throws IOException, Scanner.ScanException, Parser.ParseException, CompileException(Code)
Equivalent to
 SimpleCompiler sc = new SimpleCompiler();
 sc.cook(optionalFileName, is);

See Also:   SimpleCompiler.SimpleCompiler()
See Also:   Cookable.cook(StringInputStream)



SimpleCompiler
public SimpleCompiler(String fileName) throws IOException, Scanner.ScanException, Parser.ParseException, CompileException(Code)
Equivalent to
 SimpleCompiler sc = new SimpleCompiler();
 sc.cook(fileName);

See Also:   SimpleCompiler.SimpleCompiler()
See Also:   Cookable.cookFile(String)



SimpleCompiler
public SimpleCompiler(Scanner scanner, ClassLoader optionalParentClassLoader) throws IOException, Scanner.ScanException, Parser.ParseException, CompileException(Code)
Equivalent to
 SimpleCompiler sc = new SimpleCompiler();
 sc.setParentClassLoader(optionalParentClassLoader);
 sc.cook(scanner);

See Also:   SimpleCompiler.SimpleCompiler()
See Also:   SimpleCompiler.setParentClassLoader(ClassLoader)
See Also:   Cookable.cook(Scanner)



SimpleCompiler
public SimpleCompiler()(Code)




Method Detail
classToType
protected Java.Type classToType(Location location, Class optionalClass)(Code)
Wrap a reflection Class in a Java.Type object.



classesToTypes
protected Java.Type[] classesToTypes(Location location, Class[] classes)(Code)
Convert an array of Class es into an array of Java.Type s.



compileToClassLoader
final protected ClassLoader compileToClassLoader(Java.CompilationUnit compilationUnit, EnumeratorSet debuggingInformation) throws CompileException(Code)
Compile the given compilation unit. (A "compilation unit" is typically the contents of a JavaTM source file.)
Parameters:
  compilationUnit - The parsed compilation unit
Parameters:
  debuggingInformation - What kind of debugging information to generate in the class file The ClassLoader into which the compiled classes were defined
throws:
  CompileException -



cook
public void cook(Scanner scanner) throws CompileException, Parser.ParseException, Scanner.ScanException, IOException(Code)



equals
public boolean equals(Object o)(Code)
Two SimpleCompiler s are regarded equal iff



getClassLoader
public ClassLoader getClassLoader()(Code)
Returns a ClassLoader object through which the previously compiled classes can be accessed. This ClassLoader can be used for subsequent calls to SimpleCompiler.SimpleCompiler(Scanner,ClassLoader) in order to compile compilation units that use types (e.g. declare derived types) declared in the previous one.

This method must only be called after SimpleCompiler.cook(Scanner) .

This method must not be called for instances of derived classes.




hashCode
public int hashCode()(Code)



main
public static void main(String[] args) throws Exception(Code)



setParentClassLoader
public void setParentClassLoader(ClassLoader optionalParentClassLoader)(Code)
The "parent class loader" is used to load referenced classes. Useful values are:
System.getSystemClassLoader() The running JVM's class path
Thread.currentThread().getContextClassLoader() or null The class loader effective for the invoking thread
SimpleCompiler.BOOT_CLASS_LOADER The running JVM's boot class path
The parent class loader defaults to the current thread's context class loader.



setParentClassLoader
public void setParentClassLoader(ClassLoader optionalParentClassLoader, Class[] auxiliaryClasses)(Code)
Allowe references to the classes loaded through this parent class loader (@see SimpleCompiler.setParentClassLoader(ClassLoader) ), plus the extra auxiliaryClasses.

Notice that the auxiliaryClasses must either be loadable through the optionalParentClassLoader (in which case they have no effect), or no class with the same name must be loadable through the optionalParentClassLoader.




setUpClassLoaders
final protected void setUpClassLoaders()(Code)
Initializes SimpleCompiler.classLoader and SimpleCompiler.iClassLoader from the configured SimpleCompiler.parentClassLoader and SimpleCompiler.optionalAuxiliaryClasses . These are needed by SimpleCompiler.classToType(Location,Class) and friends which are used when creating the AST.



Methods inherited from org.codehaus.janino.Cookable
abstract public void cook(Scanner scanner) throws CompileException, Parser.ParseException, Scanner.ScanException, IOException(Code)(Java Doc)
final public void cook(Reader r) throws CompileException, Parser.ParseException, Scanner.ScanException, IOException(Code)(Java Doc)
final public void cook(String optionalFileName, Reader r) throws CompileException, Parser.ParseException, Scanner.ScanException, IOException(Code)(Java Doc)
final public void cook(InputStream is) throws CompileException, Parser.ParseException, Scanner.ScanException, IOException(Code)(Java Doc)
final public void cook(String optionalFileName, InputStream is) throws CompileException, Parser.ParseException, Scanner.ScanException, IOException(Code)(Java Doc)
final public void cook(InputStream is, String optionalEncoding) throws CompileException, Parser.ParseException, Scanner.ScanException, IOException(Code)(Java Doc)
final public void cook(String optionalFileName, InputStream is, String optionalEncoding) throws CompileException, Parser.ParseException, Scanner.ScanException, IOException(Code)(Java Doc)
final public void cook(String s) throws CompileException, Parser.ParseException, Scanner.ScanException(Code)(Java Doc)
final public void cookFile(File file) throws CompileException, Parser.ParseException, Scanner.ScanException, IOException(Code)(Java Doc)
final public void cookFile(File file, String optionalEncoding) throws CompileException, Parser.ParseException, Scanner.ScanException, IOException(Code)(Java Doc)
final public void cookFile(String fileName) throws CompileException, Parser.ParseException, Scanner.ScanException, IOException(Code)(Java Doc)
final public void cookFile(String fileName, String optionalEncoding) throws CompileException, Parser.ParseException, Scanner.ScanException, IOException(Code)(Java Doc)

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.