Class ProjectClassGenerator


  • public class ProjectClassGenerator
    extends java.lang.Object

    Purpose: Allow for a class storing a TopLink project's descriptors (meta-data) to be generated. This class can then be used at runtime to deploy the TopLink descriptor's instead of XML files.

    Since:
    TopLink 3.0
    Author:
    James Sutherland
    • Constructor Summary

      Constructors 
      Constructor Description
      ProjectClassGenerator()
      PUBLIC: Create a new generator.
      ProjectClassGenerator​(Project project)
      PUBLIC: Create a new generator to output the project.
      ProjectClassGenerator​(Project project, java.lang.String projectClassName, java.io.Writer outputWriter)
      PUBLIC: Create a new generator to output to the writer.
      ProjectClassGenerator​(Project project, java.lang.String projectClassName, java.lang.String fileName)
      PUBLIC: Create a new generator to output to the file.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void generate()
      PUBLIC: Generate the project class, output the java source code to the stream or file.
      void generate​(boolean useUnicode)
      PUBLIC: Generate the project class, output the java source code to the stream or file.
      java.lang.String getClassName()
      PUBLIC: Return the name of class to be generated.
      java.lang.String getOutputFileName()
      PUBLIC: Return the file name that the generate .java file will be output to.
      java.lang.String getOutputPath()
      PUBLIC: Return the path that the generate .java file will be output to.
      java.io.Writer getOutputWriter()
      PUBLIC: Return the writer the output to.
      java.lang.String getPackageName()
      PUBLIC: Return the package name of class to be generated.
      Project getProject()
      PUBLIC: Return the project to generate from.
      void setClassName​(java.lang.String newClassName)
      PUBLIC: Set the name of class to be generated.
      void setOutputFileName​(java.lang.String newOutputFileName)
      PUBLIC: Set the file name that the generate .java file will be output to.
      void setOutputPath​(java.lang.String newOutputPath)
      PUBLIC: Set the path that the generate .java file will be output to.
      void setOutputWriter​(java.io.Writer outputWriter)
      PUBLIC: Set the writer the output to.
      void setPackageName​(java.lang.String newPackageName)
      PUBLIC: Set the package name of class to be generated.
      void setProject​(Project newProject)
      PUBLIC: Set the project to generate from.
      static void write​(Project project, java.lang.String projectClassName, java.io.Writer writer)
      PUBLIC: Generate the source code to a project class to the project's descriptor into the writer.
      static void write​(Project project, java.lang.String projectClassName, java.lang.String fileName)
      PUBLIC: Generate the source code to a project class to the project's descriptor into the file.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ProjectClassGenerator

        public ProjectClassGenerator()
        PUBLIC: Create a new generator.
      • ProjectClassGenerator

        public ProjectClassGenerator​(Project project)
        PUBLIC: Create a new generator to output the project.
      • ProjectClassGenerator

        public ProjectClassGenerator​(Project project,
                                     java.lang.String projectClassName,
                                     java.io.Writer outputWriter)
        PUBLIC: Create a new generator to output to the writer.
      • ProjectClassGenerator

        public ProjectClassGenerator​(Project project,
                                     java.lang.String projectClassName,
                                     java.lang.String fileName)
        PUBLIC: Create a new generator to output to the file.
    • Method Detail

      • generate

        public void generate​(boolean useUnicode)
                      throws ValidationException
        PUBLIC: Generate the project 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
      • generate

        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.
        Throws:
        ValidationException
      • getClassName

        public java.lang.String getClassName()
        PUBLIC: Return the name of class to be generated. This is the unqualified name.
      • getOutputFileName

        public java.lang.String getOutputFileName()
        PUBLIC: Return the file name that the generate .java file will be output to.
      • getOutputPath

        public java.lang.String getOutputPath()
        PUBLIC: Return the path that the generate .java file will be output to.
      • getOutputWriter

        public java.io.Writer getOutputWriter()
        PUBLIC: Return the writer the output to.
      • getPackageName

        public java.lang.String getPackageName()
        PUBLIC: Return the package name of class to be generated.
      • getProject

        public Project getProject()
        PUBLIC: Return the project to generate from.
      • setClassName

        public void setClassName​(java.lang.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.
      • setOutputFileName

        public void setOutputFileName​(java.lang.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.
      • setOutputPath

        public void setOutputPath​(java.lang.String newOutputPath)
        PUBLIC: Set the path that the generate .java file will be output to.
      • setOutputWriter

        public void setOutputWriter​(java.io.Writer outputWriter)
        PUBLIC: Set the writer the output to.
      • setPackageName

        public void setPackageName​(java.lang.String newPackageName)
        PUBLIC: Set the package name of class to be generated.
      • setProject

        public void setProject​(Project newProject)
        PUBLIC: Set the project to generate from. All of the projects descriptors will be stored into the file.
      • write

        public static void write​(Project project,
                                 java.lang.String projectClassName,
                                 java.io.Writer writer)
        PUBLIC: Generate the source code to a project class to the project's descriptor into the writer.
      • write

        public static void write​(Project project,
                                 java.lang.String projectClassName,
                                 java.lang.String fileName)
        PUBLIC: Generate the source code to a project class to the project's descriptor into the file.