SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool

com.solarmetric.rd.kodo.enhance
Class CodeGenerator

java.lang.Object
  |
  +--com.solarmetric.rd.kodo.enhance.CodeGenerator

public class CodeGenerator
extends java.lang.Object

Generates Java class code from JDO metadata.


Constructor Summary
CodeGenerator(com.solarmetric.rd.kodo.conf.JDOConfiguration conf, java.lang.Class type)
          Constructor.
CodeGenerator(com.solarmetric.rd.kodo.conf.JDOConfiguration conf, com.solarmetric.rd.kodo.meta.ClassMetaData meta)
          Constructor.
 
Method Summary
 void generateCode()
          Writes the generated code to the proper directory.
protected  java.lang.String getClassCode()
          Return a code template for the given class, or null to use the standard system-generated Java code.
 java.lang.String getCode()
          Return the generated code, or null if generateCode() has not been called.
 java.io.File getCodeDirectory()
          The directory to write source to.
 serp.util.CodeFormat getCodeFormat()
          The code formatter for the generated Java code.
protected  java.lang.String getDeclaration(com.solarmetric.rd.kodo.meta.FieldMetaData field)
          Return a code template for the declaration of the given field, or null to use the system-generated default Java code.
protected  java.lang.String getFieldCode(com.solarmetric.rd.kodo.meta.FieldMetaData field)
          Return a code template for the get/set methods of the given field, or null to use the system-generated default Java code.
protected  java.io.File getFile()
          Return Java file to write to.
protected  java.lang.String getInitialValue(com.solarmetric.rd.kodo.meta.FieldMetaData field)
          Return code for the initial value for the given field, or null to use the default generated by the system.
 com.solarmetric.rd.kodo.meta.ClassMetaData getMetaData()
          Return metadata for the type being generated.
 java.lang.Class getType()
          Return the type being generated.
protected  serp.util.CodeFormat newCodeFormat()
          Return a copy of the internal code format.
 void setCodeDirectory(java.io.File dir)
          The directory to write source to.
 void setCodeFormat(serp.util.CodeFormat format)
          Set the code formatter for the generated Java code.
 void writeCode()
          Write the generated code to the proper file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CodeGenerator

public CodeGenerator(com.solarmetric.rd.kodo.conf.JDOConfiguration conf,
                     java.lang.Class type)
Constructor. Supply configuration and class to generate code for.


CodeGenerator

public CodeGenerator(com.solarmetric.rd.kodo.conf.JDOConfiguration conf,
                     com.solarmetric.rd.kodo.meta.ClassMetaData meta)
Constructor. Supply configuration and metadata to generate code for.

Method Detail

getCodeDirectory

public java.io.File getCodeDirectory()
The directory to write source to. Defaults to the current directory. If the given directory does not match the package of the metadata, the package structure will be created below the directory.


setCodeDirectory

public void setCodeDirectory(java.io.File dir)
The directory to write source to. Defaults to the current directory. If the given directory does not match the package of the metadata, the package structure will be created below the directory.


getCodeFormat

public serp.util.CodeFormat getCodeFormat()
The code formatter for the generated Java code.


setCodeFormat

public void setCodeFormat(serp.util.CodeFormat format)
Set the code formatter for the generated Java code.


getType

public java.lang.Class getType()
Return the type being generated.


getMetaData

public com.solarmetric.rd.kodo.meta.ClassMetaData getMetaData()
Return metadata for the type being generated.


getCode

public java.lang.String getCode()
Return the generated code, or null if generateCode() has not been called.


generateCode

public void generateCode()
Writes the generated code to the proper directory.


writeCode

public void writeCode()
               throws java.io.IOException
Write the generated code to the proper file.

java.io.IOException

getFile

protected java.io.File getFile()
Return Java file to write to.


newCodeFormat

protected serp.util.CodeFormat newCodeFormat()
Return a copy of the internal code format.


getClassCode

protected java.lang.String getClassCode()
Return a code template for the given class, or null to use the standard system-generated Java code. To facilitate template reuse, the following parameters can appear in the template; the proper values will be subtituted by the system: Returns null by default.


getInitialValue

protected java.lang.String getInitialValue(com.solarmetric.rd.kodo.meta.FieldMetaData field)
Return code for the initial value for the given field, or null to use the default generated by the system. Returns null by default.


getDeclaration

protected java.lang.String getDeclaration(com.solarmetric.rd.kodo.meta.FieldMetaData field)
Return a code template for the declaration of the given field, or null to use the system-generated default Java code. To facilitate template reuse, the following parameters can appear in your template; the proper values will be subtituted by the system: Returns null by default.


getFieldCode

protected java.lang.String getFieldCode(com.solarmetric.rd.kodo.meta.FieldMetaData field)
Return a code template for the get/set methods of the given field, or null to use the system-generated default Java code. To facilitate template reuse, the following parameters can appear in your template; the proper values will be subtituted by the system:


SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool

Copyright 2001,2002,2003 SolarMetric, Inc. All Rights Reserved.