DTD2Java API

ch.perseguers.xml.dtd.util
Class ClassGenerator

java.lang.Object
  extended bych.perseguers.xml.dtd.util.ClassGenerator
All Implemented Interfaces:
UtilConstants

public class ClassGenerator
extends java.lang.Object
implements UtilConstants


Field Summary
 java.util.Hashtable matchAllMethods
           
 java.util.Hashtable matchClassName
           
 
Fields inherited from interface ch.perseguers.xml.dtd.util.UtilConstants
CLASS_PREFIX_NAME, DTD2JAVA_RESERVED, FILE_SEP, JAVA_15_RESERVED, JAVA_RESERVED, MATCH_PREFIX_METHOD_NAME, MULT_CLASS_ONE, MULT_CLASS_ZERO_ONE, MULT_ONE_VECTOR, MULT_VECTOR, RESERVED_WORDS, TAB, TAB2, TAB3, TAB4, TAB5, TAB6
 
Constructor Summary
ClassGenerator()
          Constructor, setting package name to , DTD document to use to null and output directory to uninitialized.
 
Method Summary
 void generateClasses(java.util.LinkedList generatedFiles)
          Generate all classes needed by the JavaCC XML parser.
 java.util.Enumeration getClassFileNames()
          Return enumeration of generated class file names.
 void setDocument(DTDdocument document)
          Set the DTD document to use to generated the classes.
 void setNoMethodSave(boolean state)
          Do not generate method save for classes.
 void setOutputDirectory(java.lang.String outputDirectory)
          Set the output directory for all generated class files.
 void setPackageName(java.lang.String packageName)
          Set the name of the package to use for the class.
 void setRootElement(java.lang.String rootElementName)
          Set the name of the DTD root element.
 void setVerbose(boolean mode)
          Activate or Deactivate the verbose mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

matchClassName

public java.util.Hashtable matchClassName

matchAllMethods

public java.util.Hashtable matchAllMethods
Constructor Detail

ClassGenerator

public ClassGenerator()
Constructor, setting package name to , DTD document to use to null and output directory to uninitialized. Method save is generated. Verbose is deactivated.

Method Detail

setVerbose

public void setVerbose(boolean mode)
Activate or Deactivate the verbose mode.

Parameters:
mode - activates verbose
deactivates verbose

setPackageName

public void setPackageName(java.lang.String packageName)
Set the name of the package to use for the class.

Parameters:
packageName - Name of the package

setRootElement

public void setRootElement(java.lang.String rootElementName)
Set the name of the DTD root element.

Parameters:
rootElementName - Name of the DTD root element

setNoMethodSave

public void setNoMethodSave(boolean state)
Do not generate method save for classes.

Parameters:
state - TRUE for not generating method save

setOutputDirectory

public void setOutputDirectory(java.lang.String outputDirectory)
Set the output directory for all generated class files.

Parameters:
outputDirectory - Name of the directory

setDocument

public void setDocument(DTDdocument document)
Set the DTD document to use to generated the classes.

Parameters:
document - DTD document to use for generation

getClassFileNames

public java.util.Enumeration getClassFileNames()
Return enumeration of generated class file names. This method should of course only be invoked after a call to generateClasses.


generateClasses

public void generateClasses(java.util.LinkedList generatedFiles)
Generate all classes needed by the JavaCC XML parser. To make it easy to understand, each DTD element is matched as a Java class. Attributes are matched as class attribute and are accessible with common methods get[Attribute] and set[Attribute]. Sub-elements are accessible too with common methods get[Element] and set[Element].

Parameters:
generatedFiles - LinkedList containing all generated file names

DTD2Java API

Copyright © 2003-2004 - Perseguers Software Services perseguers.ch