Top Description Fields Constructors Methods
org.eclipse.persistence.sessions.factories

public Class TableCreatorClassGenerator

extends Object
Class Inheritance
Imports
java.io.FileOutputStream, .IOException, .OutputStreamWriter, .StringWriter, .Writer, org.eclipse.persistence.exceptions.ValidationException, org.eclipse.persistence.internal.codegen.ClassDefinition, .CodeGenerator, .NonreflectiveMethodDefinition, org.eclipse.persistence.internal.helper.Helper, org.eclipse.persistence.sequencing.TableSequence, org.eclipse.persistence.sessions.DatabaseLogin, org.eclipse.persistence.tools.schemaframework.FieldDefinition, .ForeignKeyConstraint, .TableCreator, .TableDefinition

Purpose: Allow for a class storing a TopLink table creator's tables (meta-data) to be generated. This class can then be used at runtime to (re)create a project's database schema.

Author
James Sutherland
Since
TopLink 3.0

Field Summary

Modifier and TypeField and Description
protected String
protected String
protected String
protected Writer
protected String
protected TableCreator

Constructor Summary

AccessConstructor and Description
public
TableCreatorClassGenerator()

PUBLIC: Create a new generator.

public
TableCreatorClassGenerator(TableCreator tableCreator)

PUBLIC: Create a new generator to output the table creator.

public
TableCreatorClassGenerator(TableCreator tableCreator, String projectClassName, Writer outputWriter)

PUBLIC: Create a new generator to output the table creator.

public
TableCreatorClassGenerator(TableCreator tableCreator, String projectClassName, String fileName)

PUBLIC: Create a new generator to output the table creator.

Method Summary

Modifier and TypeMethod and Description
protected void
protected void
protected NonreflectiveMethodDefinition
protected NonreflectiveMethodDefinition
protected NonreflectiveMethodDefinition
public void
generate(boolean useUnicode)

PUBLIC: Generate the creator class, output the java source code to the stream or file.

public void
generate()

PUBLIC: Generate the project class, output the java source code to the stream or file.

protected ClassDefinition
generateCreatorClass()

Return a class definition object representing the code to be generated for the table creator.

public String
getClassName()

PUBLIC: Return the name of class to be generated.

public String
getOutputFileName()

PUBLIC: Return the file name that the generate .java file will be output to.

public String
getOutputPath()

PUBLIC: Return the path that the generate .java file will be output to.

public Writer
getOutputWriter()

PUBLIC: Return the writer the output to.

public String
getPackageName()

PUBLIC: Return the package name of class to be generated.

public TableCreator
getTableCreator()

PUBLIC: Return the table creator to generate from.

protected String
printString(Object value)

Return the printed version of the primitive value object.

protected String
removeDots(String packageName)

public void
setClassName(String newClassName)

PUBLIC: Set the name of class to be generated.

public void
setOutputFileName(String newOutputFileName)

PUBLIC: Set the file name that the generate .java file will be output to.

public void
setOutputPath(String newOutputPath)

PUBLIC: Set the path that the generate .java file will be output to.

public void
setOutputWriter(Writer outputWriter)

PUBLIC: Set the writer the output to.

public void
setPackageName(String newPackageName)

PUBLIC: Set the package name of class to be generated.

public void
setTableCreator(TableCreator tableCreator)

PUBLIC: Set the table creator to generate from.

public static void
write(TableCreator tableCreator, String creatorClassName, Writer writer)

PUBLIC: Generate the source code to a table creator class to the table creator's tables into the writer.

public static void
write(TableCreator tableCreator, String creatorClassName, String fileName)

PUBLIC: Generate the source code to a table creator class to the table creator's tables into the file.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

classNameback to summary
protected String className
outputFileNameback to summary
protected String outputFileName
outputPathback to summary
protected String outputPath
outputWriterback to summary
protected Writer outputWriter
packageNameback to summary
protected String packageName
tableCreatorback to summary
protected TableCreator tableCreator

Constructor Detail

TableCreatorClassGeneratorback to summary
public TableCreatorClassGenerator()

PUBLIC: Create a new generator.

TableCreatorClassGeneratorback to summary
public TableCreatorClassGenerator(TableCreator tableCreator)

PUBLIC: Create a new generator to output the table creator.

TableCreatorClassGeneratorback to summary
public TableCreatorClassGenerator(TableCreator tableCreator, String projectClassName, Writer outputWriter)

PUBLIC: Create a new generator to output the table creator.

TableCreatorClassGeneratorback to summary
public TableCreatorClassGenerator(TableCreator tableCreator, String projectClassName, String fileName)

PUBLIC: Create a new generator to output the table creator.

Method Detail

addFieldLinesback to summary
protected void addFieldLines(FieldDefinition field, NonreflectiveMethodDefinition method)
addForeignKeyLinesback to summary
protected void addForeignKeyLines(ForeignKeyConstraint foreignKey, NonreflectiveMethodDefinition method)
buildConstructorback to summary
protected NonreflectiveMethodDefinition buildConstructor()
buildLoginMethodback to summary
protected NonreflectiveMethodDefinition buildLoginMethod(DatabaseLogin login)
buildTableMethodback to summary
protected NonreflectiveMethodDefinition buildTableMethod(TableDefinition table)
generateback to summary
public void generate(boolean useUnicode) throws ValidationException

PUBLIC: Generate the creator class, output the java source code to the stream or file. useUnicode determines if unicode escaped characters for non_ASCII charaters will be used.

generateback to summary
public void generate() throws ValidationException

PUBLIC: Generate the project class, output the java source code to the stream or file. Unicode escaped characters for non_ASCII charaters will be used.

generateCreatorClassback to summary
protected ClassDefinition generateCreatorClass()

Return a class definition object representing the code to be generated for the table creator. This class will have one method per descriptor and its toString can be used to convert it to code.

getClassNameback to summary
public String getClassName()

PUBLIC: Return the name of class to be generated. This is the unqualified name.

getOutputFileNameback to summary
public String getOutputFileName()

PUBLIC: Return the file name that the generate .java file will be output to.

getOutputPathback to summary
public String getOutputPath()

PUBLIC: Return the path that the generate .java file will be output to.

getOutputWriterback to summary
public Writer getOutputWriter()

PUBLIC: Return the writer the output to.

getPackageNameback to summary
public String getPackageName()

PUBLIC: Return the package name of class to be generated.

getTableCreatorback to summary
public TableCreator getTableCreator()

PUBLIC: Return the table creator to generate from.

printStringback to summary
protected String printString(Object value)

Return the printed version of the primitive value object. This must determine the class and use the correct constrcutor arguments.

removeDotsback to summary
protected String removeDots(String packageName)
setClassNameback to summary
public void setClassName(String newClassName)

PUBLIC: Set the name of class to be generated. This can be qualified or unqualified name and will set the file name to match.

setOutputFileNameback to summary
public void setOutputFileName(String newOutputFileName)

PUBLIC: Set the file name that the generate .java file will be output to. If the file does not include .java it will be appended.

setOutputPathback to summary
public void setOutputPath(String newOutputPath)

PUBLIC: Set the path that the generate .java file will be output to.

setOutputWriterback to summary
public void setOutputWriter(Writer outputWriter)

PUBLIC: Set the writer the output to.

setPackageNameback to summary
public void setPackageName(String newPackageName)

PUBLIC: Set the package name of class to be generated.

setTableCreatorback to summary
public void setTableCreator(TableCreator tableCreator)

PUBLIC: Set the table creator to generate from. All of the creator's tables will be stored into the file.

writeback to summary
public static void write(TableCreator tableCreator, String creatorClassName, Writer writer)

PUBLIC: Generate the source code to a table creator class to the table creator's tables into the writer.

writeback to summary
public static void write(TableCreator tableCreator, String creatorClassName, String fileName)

PUBLIC: Generate the source code to a table creator class to the table creator's tables into the file.