org.enhydra.xml.xmlc.codegen
Class JavaClass

java.lang.Object
  |
  +--org.enhydra.xml.xmlc.codegen.JavaClass

public final class JavaClass
extends 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
protected  String[] fDoc
           
protected  int fModifiers
           
protected  String fName
           
protected  String fPackageName
          Attributes of the class
 
Constructor Summary
JavaClass(String packageName, String name, int modifiers, String[] doc)
          Constructor.
 
Method Summary
 void addClassImport(String importSpec)
          Add an class imports to the class.
 void addClassImports(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(String implementsName)
          Add a interface that the class will implement.
 void addImplements(String[] implementsName)
          Add a list of interface for this class to implement.
 void addImport(String importSpec)
          Add an import to the class and interface.
 void addImports(String[] importSpecs)
          Add a set of imports.
 void addMethod(JavaMethod method)
          Add a method.
 JavaCode getClassInitializer()
          Get the class initializer.
 Iterator getConstructors()
          Get the constructors
 String[] getDoc()
          Get the documentation, or null if there is none.
 Iterator getFields()
          Get the fields, sorted by field name.
 Iterator getMethods()
          Get the methods, sorted by method name.
 int getModifiers()
          Get the modifiers.
 String getName()
          Get the name.
 void printClass(IndentWriter out)
          Output a generated class which doesn't have a corresponding interface.
 void printImplementation(IndentWriter out)
          Output a generated class which has an interface.
 void printInterface(IndentWriter out)
          Output a generated interface.
 void setExtends(String extendsName)
          Set the class that this class extends.
 void setInterface(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 String fPackageName
Attributes of the class

fName

protected String fName

fModifiers

protected int fModifiers

fDoc

protected String[] fDoc
Constructor Detail

JavaClass

public JavaClass(String packageName,
                 String name,
                 int modifiers,
                 String[] doc)
Constructor.
Parameters:
packageName - package for the class, or null for default package.
name - class name
modifiers - class modifier bit set.
doc - Class documentation, each row becomes a line of documentation.
See Also:
JavaModifiers
Method Detail

setInterface

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

addClassImport

public void addClassImport(String importSpec)
Add an class imports to the class. These will not be in any generated interface.
Parameters:
importSpec - Name package, class, or package.* to import. Should not include import keyword. Duplicates will be discarded.

addClassImports

public void addClassImports(String[] importSpecs)
Add a set of class imports. These will not be in any generated interface.
Parameters:
importSpecs - Names of packages, classes, or package.* to import. Should not include import keyword.

addImport

public void addImport(String importSpec)
Add an import to the class and interface.
Parameters:
importSpec - Name package, class, or package.* to import. Should not include import keyword. Duplicates will be discarded.

addImports

public void addImports(String[] importSpecs)
Add a set of imports.
Parameters:
importSpecs - Names of packages, classes, or package.* to import. Should not include import keyword. Duplicates will be discarded.

setExtends

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

addImplements

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

addImplements

public void addImplements(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 String getName()
Get the name.

getModifiers

public int getModifiers()
Get the modifiers.

getDoc

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

getFields

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

getClassInitializer

public JavaCode getClassInitializer()
Get the class initializer.

getConstructors

public Iterator getConstructors()
Get the constructors

getMethods

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

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.


Copyright © 1999-2002 enhydra.org (Mark Diekhans, David Li, Richard Kunze). All Rights reserved.