Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.enhydra.xml.xmlc.codegen
Class JavaClass  view JavaClass download JavaClass.java

java.lang.Object
  extended byorg.enhydra.xml.xmlc.codegen.JavaClass

public final class JavaClass
extends java.lang.Object

Object that is used to assemble the Java source for a class. Able to generate either a stand-alone class, or an interface and an implementation of that interface


Field Summary
private  java.util.TreeSet fClassImports
          Imports to use for the class but not the interface,
private  JavaCode fClassInitializer
          Class initializer.
private  java.util.ArrayList fConstructors
          Constructors associated with the class.
protected  java.lang.String[] fDoc
           
private  java.lang.String fExtends
          Class that this class extends, or null.
private  java.util.TreeMap fFields
          Fields associated with the class.
private  java.util.TreeSet fImplements
          List of interfaces that this class extends.
private  java.util.TreeSet fImports
          Imports to for both class and interface.
private  java.lang.String fInterface
          If the class is also going to have an associated generated interface, this is its name.
private  java.util.TreeMap fMethods
          Methods associated with the class.
protected  int fModifiers
           
protected  java.lang.String fName
           
protected  java.lang.String fPackageName
          Attributes of the class
 
Constructor Summary
JavaClass(java.lang.String packageName, java.lang.String name, int modifiers, java.lang.String[] doc)
          Constructor.
 
Method Summary
 void addClassImport(java.lang.String importSpec)
          Add an class imports to the class.
 void addClassImports(java.lang.String[] importSpecs)
          Add a set of class imports.
 void addConstructor(JavaMethod method)
          Add a constructor.
 void addField(JavaField field)
          Add a field to the class.
 void addImplements(java.lang.String implementsName)
          Add a interface that the class will implement.
 void addImplements(java.lang.String[] implementsName)
          Add a list of interface for this class to implement.
 void addImport(java.lang.String importSpec)
          Add an import to the class and interface.
 void addImports(java.lang.String[] importSpecs)
          Add a set of imports.
 void addMethod(JavaMethod method)
          Add a method.
 JavaCode getClassInitializer()
          Get the class initializer.
 java.util.Iterator getConstructors()
          Get the constructors
 java.lang.String[] getDoc()
          Get the documentation, or null if there is none.
 java.util.Iterator getFields()
          Get the fields, sorted by field name.
 java.util.Iterator getMethods()
          Get the methods, sorted by method name.
 int getModifiers()
          Get the modifiers.
 java.lang.String getName()
          Get the name.
private  void printBody(IndentWriter out, boolean printMethodBodies, int omitFlags)
          Print the body of a class, interface, or implementation.
 void printClass(IndentWriter out)
          Output a generated class which doesn't have a corresponding interface.
private  void printClassDecl(IndentWriter out)
          Print the class declaration.
private  void printClassInitializer(IndentWriter out, boolean printMethodBodies)
          Print the class initializer
private  void printConstructors(IndentWriter out, boolean printMethodBodies, int omitFlags)
          Print the constructors
private  void printFields(IndentWriter out, int omitFlags)
          Print the fields
 void printImplementation(IndentWriter out)
          Output a generated class which has an interface.
private  void printImplExtends(IndentWriter out, java.lang.String keyword, java.lang.String single, java.util.Set set)
          Generate `implements' clause for classes or `extends' clause for interfaces.
private  void printImports(IndentWriter out, java.util.Set importSet)
          Output a set of imports.
 void printInterface(IndentWriter out)
          Output a generated interface.
private  void printInterfaceDecl(IndentWriter out)
          Print the interface declaration.
private  void printMethods(IndentWriter out, boolean printMethodBodies, int omitFlags)
          Print the methods
private  void printStart(IndentWriter out, boolean forInterface)
          Print the package, imports and comment.
 void setExtends(java.lang.String extendsName)
          Set the class that this class extends.
 void setInterface(java.lang.String interfaceName)
          Set the interface name for the associated generated interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fPackageName

protected java.lang.String fPackageName
Attributes of the class


fName

protected java.lang.String fName

fModifiers

protected int fModifiers

fDoc

protected java.lang.String[] fDoc

fClassImports

private java.util.TreeSet fClassImports
Imports to use for the class but not the interface,


fImports

private java.util.TreeSet fImports
Imports to for both class and interface.


fExtends

private java.lang.String fExtends
Class that this class extends, or null.


fInterface

private java.lang.String fInterface
If the class is also going to have an associated generated interface, this is its name.


fImplements

private java.util.TreeSet fImplements
List of interfaces that this class extends.


fFields

private java.util.TreeMap fFields
Fields associated with the class.


fClassInitializer

private JavaCode fClassInitializer
Class initializer.


fConstructors

private java.util.ArrayList fConstructors
Constructors associated with the class.


fMethods

private java.util.TreeMap fMethods
Methods associated with the class.

Constructor Detail

JavaClass

public JavaClass(java.lang.String packageName,
                 java.lang.String name,
                 int modifiers,
                 java.lang.String[] doc)
Constructor.

Method Detail

setInterface

public void setInterface(java.lang.String interfaceName)
Set the interface name for the associated generated interface.


addClassImport

public void addClassImport(java.lang.String importSpec)
Add an class imports to the class. These will not be in any generated interface.


addClassImports

public void addClassImports(java.lang.String[] importSpecs)
Add a set of class imports. These will not be in any generated interface.


addImport

public void addImport(java.lang.String importSpec)
Add an import to the class and interface.


addImports

public void addImports(java.lang.String[] importSpecs)
Add a set of imports.


setExtends

public void setExtends(java.lang.String extendsName)
Set the class that this class extends.


addImplements

public void addImplements(java.lang.String implementsName)
Add a interface that the class will implement.


addImplements

public void addImplements(java.lang.String[] implementsName)
Add a list of interface for this class to implement.


addField

public void addField(JavaField field)
Add a field to the class.


addConstructor

public void addConstructor(JavaMethod method)
Add a constructor.


addMethod

public void addMethod(JavaMethod method)
Add a method.


getName

public java.lang.String getName()
Get the name.


getModifiers

public int getModifiers()
Get the modifiers.


getDoc

public java.lang.String[] getDoc()
Get the documentation, or null if there is none.


getFields

public java.util.Iterator getFields()
Get the fields, sorted by field name.


getClassInitializer

public JavaCode getClassInitializer()
Get the class initializer.


getConstructors

public java.util.Iterator getConstructors()
Get the constructors


getMethods

public java.util.Iterator getMethods()
Get the methods, sorted by method name.


printImports

private void printImports(IndentWriter out,
                          java.util.Set importSet)
Output a set of imports.


printStart

private void printStart(IndentWriter out,
                        boolean forInterface)
Print the package, imports and comment.


printImplExtends

private void printImplExtends(IndentWriter out,
                              java.lang.String keyword,
                              java.lang.String single,
                              java.util.Set set)
Generate `implements' clause for classes or `extends' clause for interfaces.


printClassDecl

private void printClassDecl(IndentWriter out)
Print the class declaration.


printInterfaceDecl

private void printInterfaceDecl(IndentWriter out)
Print the interface declaration.


printFields

private void printFields(IndentWriter out,
                         int omitFlags)
Print the fields


printClassInitializer

private void printClassInitializer(IndentWriter out,
                                   boolean printMethodBodies)
Print the class initializer


printConstructors

private void printConstructors(IndentWriter out,
                               boolean printMethodBodies,
                               int omitFlags)
Print the constructors


printMethods

private void printMethods(IndentWriter out,
                          boolean printMethodBodies,
                          int omitFlags)
Print the methods


printBody

private void printBody(IndentWriter out,
                       boolean printMethodBodies,
                       int omitFlags)
Print the body of a class, interface, or implementation.


printClass

public void printClass(IndentWriter out)
Output a generated class which doesn't have a corresponding interface.


printInterface

public void printInterface(IndentWriter out)
Output a generated interface.


printImplementation

public void printImplementation(IndentWriter out)
Output a generated class which has an interface.