Java Doc for JCodeModel.java in  » 6.0-JDK-Modules » jaxb-xjc » com » sun » codemodel » 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 » 6.0 JDK Modules » jaxb xjc » com.sun.codemodel 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sun.codemodel.JCodeModel

JCodeModel
final public class JCodeModel (Code)
Root of the code DOM.

Here's your typical CodeModel application.

 JCodeModel cm = new JCodeModel();
 // generate source code by populating the 'cm' tree.
 cm._class(...);
 ...
 // write them out
 cm.build(new File("."));
 

Every CodeModel node is always owned by one JCodeModel object at any given time (which can be often accesesd by the owner() method.) As such, when you generate Java code, most of the operation works in a top-down fashion. For example, you create a class from JCodeModel , which gives you a JDefinedClass . Then you invoke a method on it to generate a new method, which gives you JMethod , and so on. There are a few exceptions to this, most notably building JExpression s, but generally you work with CodeModel in a top-down fashion. Because of this design, most of the CodeModel classes aren't directly instanciable.

Where to go from here?

Most of the time you'd want to populate new type definitions in a JCodeModel . See JCodeModel._class(String,ClassType) .



Field Summary
final public  JPrimitiveTypeBOOLEAN
    
final public  JPrimitiveTypeBYTE
    
final public  JPrimitiveTypeCHAR
    
final public  JPrimitiveTypeDOUBLE
    
final public  JPrimitiveTypeFLOAT
    
final public  JPrimitiveTypeINT
    
final public  JPrimitiveTypeLONG
    
final public  JNullTypeNULL
     Obtains a reference to the special "null" type.
final public  JPrimitiveTypeSHORT
    
final public  JPrimitiveTypeVOID
    
final public static  Map<Class, Class>boxToPrimitive
    
final protected static  booleanisCaseSensitiveFileSystem
     If the flag is true, we will consider two classes "Foo" and "foo" as a collision.
final public static  Map<Class, Class>primitiveToBox
    

Constructor Summary
public  JCodeModel()
    

Method Summary
public  JDefinedClass_class(String fullyqualifiedName)
     Creates a new generated class.
public  JDefinedClass_class(String fullyqualifiedName, ClassType t)
     Creates a new generated class.
public  JDefinedClass_getClass(String fullyQualifiedName)
     Gets a reference to the already created generated class.
public  JPackage_package(String name)
     Add a package to the list of packages to be generated
Parameters:
  name - Name of the package.
public  JType_ref(Class c)
    
public  JDefinedClassanonymousClass(JClass baseType)
     Creates a new anonymous class.
public  JDefinedClassanonymousClass(Class baseType)
    
public  voidbuild(File destDir, PrintStream status)
     Generates Java source code.
public  voidbuild(File srcDir, File resourceDir, PrintStream status)
     Generates Java source code.
public  voidbuild(File destDir)
     A convenience method for build(destDir,System.out).
public  voidbuild(File srcDir, File resourceDir)
     A convenience method for build(srcDir,resourceDir,System.out).
public  voidbuild(CodeWriter out)
     A convenience method for build(out,out).
public  voidbuild(CodeWriter source, CodeWriter resource)
     Generates Java source code.
public  intcountArtifacts()
     Returns the number of files to be generated if JCodeModel.build is invoked now.
public  JClassdirectClass(String name)
     Creates a dummy, unknown JClass that represents a given name.
public  JDefinedClassnewAnonymousClass(JClass baseType)
     Creates a new anonymous class.
public  Iterator<JPackage>packages()
     Returns an iterator that walks the packages defined using this code writer.
public  JTypeparseType(String name)
     Obtains a type object from a type name.
public  JClassref(Class clazz)
     Obtains a reference to an existing class from its Class object.
public  JClassref(String fullyQualifiedClassName)
     Obtains a reference to an existing class from its fully-qualified class name.
final public  JPackagerootPackage()
    
public  JClasswildcard()
     Gets a JClass representation for "?", which is equivalent to "? extends Object".

Field Detail
BOOLEAN
final public JPrimitiveType BOOLEAN(Code)



BYTE
final public JPrimitiveType BYTE(Code)



CHAR
final public JPrimitiveType CHAR(Code)



DOUBLE
final public JPrimitiveType DOUBLE(Code)



FLOAT
final public JPrimitiveType FLOAT(Code)



INT
final public JPrimitiveType INT(Code)



LONG
final public JPrimitiveType LONG(Code)



NULL
final public JNullType NULL(Code)
Obtains a reference to the special "null" type.



SHORT
final public JPrimitiveType SHORT(Code)



VOID
final public JPrimitiveType VOID(Code)



boxToPrimitive
final public static Map<Class, Class> boxToPrimitive(Code)
The reverse look up for JCodeModel.primitiveToBox



isCaseSensitiveFileSystem
final protected static boolean isCaseSensitiveFileSystem(Code)
If the flag is true, we will consider two classes "Foo" and "foo" as a collision.



primitiveToBox
final public static Map<Class, Class> primitiveToBox(Code)
Conversion from primitive type Class (such as Integer.TYPE to its boxed type (such as Integer.class)




Constructor Detail
JCodeModel
public JCodeModel()(Code)




Method Detail
_class
public JDefinedClass _class(String fullyqualifiedName) throws JClassAlreadyExistsException(Code)
Creates a new generated class.
exception:
  JClassAlreadyExistsException - When the specified class/interface was already created.



_class
public JDefinedClass _class(String fullyqualifiedName, ClassType t) throws JClassAlreadyExistsException(Code)
Creates a new generated class.
exception:
  JClassAlreadyExistsException - When the specified class/interface was already created.



_getClass
public JDefinedClass _getClass(String fullyQualifiedName)(Code)
Gets a reference to the already created generated class. nullIf the class is not yet created.
See Also:   JPackage._getClass(String)



_package
public JPackage _package(String name)(Code)
Add a package to the list of packages to be generated
Parameters:
  name - Name of the package. Use "" to indicate the root package. Newly generated package



_ref
public JType _ref(Class c)(Code)



anonymousClass
public JDefinedClass anonymousClass(JClass baseType)(Code)
Creates a new anonymous class.



anonymousClass
public JDefinedClass anonymousClass(Class baseType)(Code)



build
public void build(File destDir, PrintStream status) throws IOException(Code)
Generates Java source code. A convenience method for build(destDir,destDir,System.out).
Parameters:
  destDir - source files are generated into this directory.
Parameters:
  status - if non-null, progress indication will be sent to this stream.



build
public void build(File srcDir, File resourceDir, PrintStream status) throws IOException(Code)
Generates Java source code. A convenience method that calls JCodeModel.build(CodeWriter,CodeWriter) .
Parameters:
  srcDir - Java source files are generated into this directory.
Parameters:
  resourceDir - Other resource files are generated into this directory.
Parameters:
  status - if non-null, progress indication will be sent to this stream.



build
public void build(File destDir) throws IOException(Code)
A convenience method for build(destDir,System.out).



build
public void build(File srcDir, File resourceDir) throws IOException(Code)
A convenience method for build(srcDir,resourceDir,System.out).



build
public void build(CodeWriter out) throws IOException(Code)
A convenience method for build(out,out).



build
public void build(CodeWriter source, CodeWriter resource) throws IOException(Code)
Generates Java source code.



countArtifacts
public int countArtifacts()(Code)
Returns the number of files to be generated if JCodeModel.build is invoked now.



directClass
public JClass directClass(String name)(Code)
Creates a dummy, unknown JClass that represents a given name.

This method is useful when the code generation needs to include the user-specified class that may or may not exist, and only thing known about it is a class name.




newAnonymousClass
public JDefinedClass newAnonymousClass(JClass baseType)(Code)
Creates a new anonymous class. JCodeModel.anonymousClass(JClass)



packages
public Iterator<JPackage> packages()(Code)
Returns an iterator that walks the packages defined using this code writer.



parseType
public JType parseType(String name) throws ClassNotFoundException(Code)
Obtains a type object from a type name.

This method handles primitive types, arrays, and existing Class es.
exception:
  ClassNotFoundException - If the specified type is not found.




ref
public JClass ref(Class clazz)(Code)
Obtains a reference to an existing class from its Class object.

The parameter may not be primitive.
See Also:   JCodeModel._ref(Class)
See Also:    for the version that handles more cases.




ref
public JClass ref(String fullyQualifiedClassName)(Code)
Obtains a reference to an existing class from its fully-qualified class name.

First, this method attempts to load the class of the given name. If that fails, we assume that the class is derived straight from Object , and return a JClass .




rootPackage
final public JPackage rootPackage()(Code)



wildcard
public JClass wildcard()(Code)
Gets a JClass representation for "?", which is equivalent to "? extends Object".



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.