Class TableCreatorClassGenerator
java.lang.Object
org.eclipse.persistence.sessions.factories.TableCreatorClassGenerator
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
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionPUBLIC: Create a new generator.TableCreatorClassGenerator(TableCreator tableCreator) PUBLIC: Create a new generator to output the table creator.TableCreatorClassGenerator(TableCreator tableCreator, String projectClassName, Writer outputWriter) PUBLIC: Create a new generator to output the table creator.TableCreatorClassGenerator(TableCreator tableCreator, String projectClassName, String fileName) PUBLIC: Create a new generator to output the table creator.
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidaddFieldLines(FieldDefinition field, org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method) protected voidaddForeignKeyLines(ForeignKeyConstraint foreignKey, org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method) protected org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinitionprotected org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinitionbuildLoginMethod(DatabaseLogin login) protected org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinitionbuildTableMethod(TableDefinition table) voidgenerate()PUBLIC: Generate the project class, output the java source code to the stream or file.voidgenerate(boolean useUnicode) PUBLIC: Generate the creator class, output the java source code to the stream or file.protected org.eclipse.persistence.internal.codegen.ClassDefinitionReturn a class definition object representing the code to be generated for the table creator.PUBLIC: Return the name of class to be generated.PUBLIC: Return the file name that the generate .java file will be output to.PUBLIC: Return the path that the generate .java file will be output to.PUBLIC: Return the writer the output to.PUBLIC: Return the package name of class to be generated.PUBLIC: Return the table creator to generate from.protected StringprintString(Object value) Return the printed version of the primitive value object.protected StringremoveDots(String packageName) voidsetClassName(String newClassName) PUBLIC: Set the name of class to be generated.voidsetOutputFileName(String newOutputFileName) PUBLIC: Set the file name that the generate .java file will be output to.voidsetOutputPath(String newOutputPath) PUBLIC: Set the path that the generate .java file will be output to.voidsetOutputWriter(Writer outputWriter) PUBLIC: Set the writer the output to.voidsetPackageName(String newPackageName) PUBLIC: Set the package name of class to be generated.voidsetTableCreator(TableCreator tableCreator) PUBLIC: Set the table creator to generate from.static voidwrite(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.static voidwrite(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.
- 
Field Details- 
className
- 
packageName
- 
outputPath
- 
outputFileName
- 
outputWriter
- 
tableCreator
 
- 
- 
Constructor Details- 
TableCreatorClassGeneratorpublic TableCreatorClassGenerator()PUBLIC: Create a new generator.
- 
TableCreatorClassGeneratorPUBLIC: Create a new generator to output the table creator.
- 
TableCreatorClassGeneratorpublic TableCreatorClassGenerator(TableCreator tableCreator, String projectClassName, Writer outputWriter) PUBLIC: Create a new generator to output the table creator.
- 
TableCreatorClassGeneratorpublic TableCreatorClassGenerator(TableCreator tableCreator, String projectClassName, String fileName) PUBLIC: Create a new generator to output the table creator.
 
- 
- 
Method Details- 
addFieldLinesprotected void addFieldLines(FieldDefinition field, org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method) 
- 
addForeignKeyLinesprotected void addForeignKeyLines(ForeignKeyConstraint foreignKey, org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition method) 
- 
buildConstructorprotected org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition buildConstructor()
- 
buildLoginMethodprotected org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition buildLoginMethod(DatabaseLogin login) 
- 
buildTableMethodprotected org.eclipse.persistence.internal.codegen.NonreflectiveMethodDefinition buildTableMethod(TableDefinition table) 
- 
generatePUBLIC: 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.- Throws:
- ValidationException
 
- 
generatePUBLIC: Generate the project class, output the java source code to the stream or file. Unicode escaped characters for non_ASCII charaters will be used.- Throws:
- ValidationException
 
- 
generateCreatorClassprotected org.eclipse.persistence.internal.codegen.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.
- 
getClassNamePUBLIC: Return the name of class to be generated. This is the unqualified name.
- 
getOutputFileNamePUBLIC: Return the file name that the generate .java file will be output to.
- 
getOutputPathPUBLIC: Return the path that the generate .java file will be output to.
- 
getOutputWriterPUBLIC: Return the writer the output to.
- 
getPackageNamePUBLIC: Return the package name of class to be generated.
- 
getTableCreatorPUBLIC: Return the table creator to generate from.
- 
printStringReturn the printed version of the primitive value object. This must determine the class and use the correct constrcutor arguments.
- 
removeDots
- 
setClassNamePUBLIC: Set the name of class to be generated. This can be qualified or unqualified name and will set the file name to match.
- 
setOutputFileNamePUBLIC: Set the file name that the generate .java file will be output to. If the file does not include .java it will be appended.
- 
setOutputPathPUBLIC: Set the path that the generate .java file will be output to.
- 
setOutputWriterPUBLIC: Set the writer the output to.
- 
setPackageNamePUBLIC: Set the package name of class to be generated.
- 
setTableCreatorPUBLIC: Set the table creator to generate from. All of the creator's tables will be stored into the file.
- 
writePUBLIC: Generate the source code to a table creator class to the table creator's tables into the writer.
- 
writePUBLIC: Generate the source code to a table creator class to the table creator's tables into the file.
 
-