org.biomage.tools.generate_java
Class CreateJavaFile

java.lang.Object
  extended by org.biomage.tools.generate_java.CreateJavaFile
Direct Known Subclasses:
CreateJavaClassFile, CreateJavaMAGEFile, CreateJavaPackageFile

public class CreateJavaFile
extends java.lang.Object

Description: Base Class for other classes to generate Java class files.


Nested Class Summary
 class CreateJavaFile.rankComparator
          Description: An inner class which implements the Comparator Interface.
protected  class CreateJavaFile.WriteAssociationAttrInformation
          Description: Inner class to hold association attribute information.
protected  class CreateJavaFile.WriteAttrInformation
          Description: Inner class to write attribute information.
protected  class CreateJavaFile.WriteRoleInformation
           
 
Constructor Summary
protected CreateJavaFile(CreateFile createFile)
           
 
Method Summary
protected  java.lang.String getAttrVarName(CreateFile.AttrInformation attr)
          Description: Pass through to return the variable name to write out.
 void printJavaClassFile(java.lang.String fullOutputDir, java.lang.String packagePath, java.io.File header)
          Description: From the parsed information creates the file itself.
protected  void writeAssnAttrDecl(java.io.FileWriter writer)
          Description: Writes the association declarations out to the file.
protected  void writeAssnAttrMethods(java.io.FileWriter writer)
          Description: Writes the association declarations out to the file.
protected  void writeAttrDecl(java.io.FileWriter writer, java.util.Vector attrInfo, CreateJavaFile.WriteAttrInformation writeAttr)
          Description: Writes the attribute declarations out to the file.
protected  void writeAttributeConstructor(java.io.FileWriter writer)
          Description: Writes the attribute constructor out to the file.
protected  void writeAttrMethods(java.io.FileWriter writer, java.util.Vector attrInfo, CreateJavaFile.WriteAttrInformation writeAttr)
          Description: Writes the attribute declarations out to the file.
protected  void writeClassDecl(java.io.FileWriter writer)
          Description: Writes the class declaration out to the file.
protected  void writeDataAttrDecl(java.io.FileWriter writer)
          Description: Writes the data declarations out to the file.
protected  void writeDataAttrMethods(java.io.FileWriter writer)
          Description: Writes the data declarations out to the file.
protected  void writeDefaultConstructor(java.io.FileWriter writer)
          Description: Writes the default constructor out to the file.
static void writeExceptionClass(java.lang.String fullOutputDir, java.io.File header, java.io.File mageException)
          Description: Writes the exception class template out to a file.
protected  void writeImports(java.io.FileWriter writer, java.lang.String packagePath)
          Description: Writes the import list to the file.
protected  void writeXMLWriterMethods(java.io.FileWriter writer)
          Description: Writes the methods for generating XML from the object data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CreateJavaFile

protected CreateJavaFile(CreateFile createFile)
Method Detail

getAttrVarName

protected java.lang.String getAttrVarName(CreateFile.AttrInformation attr)
                                   throws java.lang.Exception
Description: Pass through to return the variable name to write out. Base class simply returns the attribute name

Returns:
name.

Throws:
java.lang.Exception

printJavaClassFile

public void printJavaClassFile(java.lang.String fullOutputDir,
                               java.lang.String packagePath,
                               java.io.File header)
                        throws java.lang.Exception
Description: From the parsed information creates the file itself.

Parameters:
fullOutputDir: - the full path for the project.
packagePath: - the directory from which to start from.
header: - the preamble copyright and creation information.

Throws:
java.lang.Exception

writeDefaultConstructor

protected void writeDefaultConstructor(java.io.FileWriter writer)
                                throws java.lang.Exception
Description: Writes the default constructor out to the file.

Parameters:
writer: - FileWriter to used to write to the file.

Throws:
java.lang.Exception

writeXMLWriterMethods

protected void writeXMLWriterMethods(java.io.FileWriter writer)
                              throws java.lang.Exception
Description: Writes the methods for generating XML from the object data.

Parameters:
writer: - FileWriter to used to write to the file.

Throws:
java.lang.Exception

writeAttributeConstructor

protected void writeAttributeConstructor(java.io.FileWriter writer)
                                  throws java.lang.Exception
Description: Writes the attribute constructor out to the file.

Parameters:
writer: - FileWriter to used to write to the file.

Throws:
java.lang.Exception

writeExceptionClass

public static void writeExceptionClass(java.lang.String fullOutputDir,
                                       java.io.File header,
                                       java.io.File mageException)
                                throws java.lang.Exception
Description: Writes the exception class template out to a file.

Parameters:
fullOutputDir: - the full path for the project.
header: - File for the header information.
header: - File for the MAGEException class.

Throws:
java.lang.Exception

writeImports

protected void writeImports(java.io.FileWriter writer,
                            java.lang.String packagePath)
                     throws java.lang.Exception
Description: Writes the import list to the file.

Parameters:
writer: - FileWriter to used to write to the file.
packagePath: - string to prepend to the package names.

Throws:
java.lang.Exception

writeClassDecl

protected void writeClassDecl(java.io.FileWriter writer)
                       throws java.lang.Exception
Description: Writes the class declaration out to the file.

Parameters:
writer: - FileWriter to used to write to the file.

Throws:
java.lang.Exception

writeDataAttrDecl

protected void writeDataAttrDecl(java.io.FileWriter writer)
                          throws java.lang.Exception
Description: Writes the data declarations out to the file.

Parameters:
writer: - FileWriter to used to write to the file.

Throws:
java.lang.Exception

writeAssnAttrDecl

protected void writeAssnAttrDecl(java.io.FileWriter writer)
                          throws java.lang.Exception
Description: Writes the association declarations out to the file.

Parameters:
writer: - FileWriter to used to write to the file.

Throws:
java.lang.Exception

writeAttrDecl

protected void writeAttrDecl(java.io.FileWriter writer,
                             java.util.Vector attrInfo,
                             CreateJavaFile.WriteAttrInformation writeAttr)
                      throws java.lang.Exception
Description: Writes the attribute declarations out to the file.

Parameters:
writer: - FileWriter to used to write to the file.
attrInfo: - Vector of the attribute information.
attrWriter: - class to use to do the writing.

Throws:
java.lang.Exception

writeDataAttrMethods

protected void writeDataAttrMethods(java.io.FileWriter writer)
                             throws java.lang.Exception
Description: Writes the data declarations out to the file.

Parameters:
writer: - FileWriter to use to write to the file.

Throws:
java.lang.Exception

writeAssnAttrMethods

protected void writeAssnAttrMethods(java.io.FileWriter writer)
                             throws java.lang.Exception
Description: Writes the association declarations out to the file.

Parameters:
writer: - FileWriter to used to write to the file.

Throws:
java.lang.Exception

writeAttrMethods

protected void writeAttrMethods(java.io.FileWriter writer,
                                java.util.Vector attrInfo,
                                CreateJavaFile.WriteAttrInformation writeAttr)
                         throws java.lang.Exception
Description: Writes the attribute declarations out to the file.

Parameters:
writer: - FileWriter to used to write to the file.
attrInfo: - Vector of the attribute information.
attrWriter: - class to use to do the writing.

Throws:
java.lang.Exception