Class PackageOutputManager

  • All Implemented Interfaces:
    OutputManager

    public class PackageOutputManager
    extends java.lang.Object
    implements OutputManager
    OutputManager for managing the creation of Java source files as the target of code generation. The character encoding for the Writer is UTF-8.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.io.File outputDir  
    • Constructor Summary

      Constructors 
      Constructor Description
      PackageOutputManager​(java.lang.String baseDirName, java.lang.String packageName)
      Create a new OutputManager for generating Java source files into a given package.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.Writer createOutput​(java.lang.String name)
      Create a new output which will be a Java source file in the given package.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • outputDir

        private final java.io.File outputDir
    • Constructor Detail

      • PackageOutputManager

        public PackageOutputManager​(java.lang.String baseDirName,
                                    java.lang.String packageName)
        Create a new OutputManager for generating Java source files into a given package.
        Parameters:
        baseDirName - for the generated source code.
        packageName - for the generated source code relative to the baseDirName.
    • Method Detail

      • createOutput

        public java.io.Writer createOutput​(java.lang.String name)
                                    throws java.io.IOException
        Create a new output which will be a Java source file in the given package.

        The Writer should be closed once the caller has finished with it. The Writer is buffered for efficient IO operations.

        Specified by:
        createOutput in interface OutputManager
        Parameters:
        name - the name of the Java class.
        Returns:
        a Writer to which the source code should be written.
        Throws:
        java.io.IOException - if an issue occurs when creating the file.