Class CodeGenerator

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

    public class CodeGenerator
    extends org.apache.maven.plugin.AbstractMojo
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.io.File doNotReplaceMainDirectory
      Location of manually-mantained files.
      private java.io.File doNotReplaceTestDirectory
      Location of manually-maintained files.
      private org.apache.maven.shared.model.fileset.util.FileSetManager fileSetManager  
      private java.lang.String keyTypes
      Comma-separated list of key types.
      private java.lang.String[] mainExcludes
      Exclusion patterns -- files NOT to generate.
      private org.apache.velocity.app.VelocityEngine mainVelocityEngine  
      private static java.lang.String[] NO_STRINGS  
      private java.io.File outputDirectory
      Path where the generated sources should be placed
      private org.apache.maven.project.MavenProject project  
      private java.lang.String sourceTemplateRoot  
      private java.lang.String[] testExcludes
      Exclusion patterns -- files NOT to generate.
      private java.io.File testOutputDirectory
      Path where the generated sources should be placed
      private java.lang.String testTemplateRoot  
      private org.apache.velocity.app.VelocityEngine testVelocityEngine  
      private java.util.Map<java.lang.String,​java.lang.String> typeToObjectTypeMap  
      private static java.nio.charset.Charset UTF8  
      private java.lang.String valueTypes
      Comma-separated list of value types.
      • Fields inherited from interface org.apache.maven.plugin.Mojo

        ROLE
    • Constructor Summary

      Constructors 
      Constructor Description
      CodeGenerator()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void execute()  
      private void expandOneTemplate​(org.apache.velocity.app.VelocityEngine engine, java.lang.String templateName, java.io.File thisOutputDirectory, java.io.File thisDoNotReplaceDirectory, java.lang.String[] excludes, java.lang.String packageDirectory, java.lang.String key, java.lang.String value)  
      private void initializeVelocity()  
      private void processOneTemplate​(org.apache.velocity.app.VelocityEngine engine, java.lang.String template, java.io.File thisOutputDirectory, java.io.File thisDoNotReplaceDirectory, java.lang.String packageDirectory, java.lang.String[] excludes)  
      private void runGeneration​(java.lang.String thisSourceRoot, org.apache.velocity.app.VelocityEngine engine, java.io.File thisOutputDirectory, java.io.File thisDoNotReplaceDirectory, java.lang.String[] excludes)  
      • Methods inherited from class org.apache.maven.plugin.AbstractMojo

        getLog, getPluginContext, setLog, setPluginContext
      • Methods inherited from class java.lang.Object

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

      • NO_STRINGS

        private static final java.lang.String[] NO_STRINGS
      • UTF8

        private static final java.nio.charset.Charset UTF8
      • typeToObjectTypeMap

        private final java.util.Map<java.lang.String,​java.lang.String> typeToObjectTypeMap
      • testTemplateRoot

        private java.lang.String testTemplateRoot
      • testOutputDirectory

        private java.io.File testOutputDirectory
        Path where the generated sources should be placed
      • sourceTemplateRoot

        private java.lang.String sourceTemplateRoot
      • outputDirectory

        private java.io.File outputDirectory
        Path where the generated sources should be placed
      • doNotReplaceMainDirectory

        private java.io.File doNotReplaceMainDirectory
        Location of manually-mantained files. This plugin won't create a file that would compete with one of these.
      • doNotReplaceTestDirectory

        private java.io.File doNotReplaceTestDirectory
        Location of manually-maintained files. This plugin won't create a file that would compete with one of these.
      • mainExcludes

        private java.lang.String[] mainExcludes
        Exclusion patterns -- files NOT to generate.
      • testExcludes

        private java.lang.String[] testExcludes
        Exclusion patterns -- files NOT to generate.
      • valueTypes

        private java.lang.String valueTypes
        Comma-separated list of value types.
      • keyTypes

        private java.lang.String keyTypes
        Comma-separated list of key types.
      • project

        private org.apache.maven.project.MavenProject project
      • testVelocityEngine

        private org.apache.velocity.app.VelocityEngine testVelocityEngine
      • fileSetManager

        private final org.apache.maven.shared.model.fileset.util.FileSetManager fileSetManager
      • mainVelocityEngine

        private org.apache.velocity.app.VelocityEngine mainVelocityEngine
    • Constructor Detail

      • CodeGenerator

        public CodeGenerator()
    • Method Detail

      • execute

        public void execute()
                     throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • initializeVelocity

        private void initializeVelocity()
                                 throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • runGeneration

        private void runGeneration​(java.lang.String thisSourceRoot,
                                   org.apache.velocity.app.VelocityEngine engine,
                                   java.io.File thisOutputDirectory,
                                   java.io.File thisDoNotReplaceDirectory,
                                   java.lang.String[] excludes)
                            throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • processOneTemplate

        private void processOneTemplate​(org.apache.velocity.app.VelocityEngine engine,
                                        java.lang.String template,
                                        java.io.File thisOutputDirectory,
                                        java.io.File thisDoNotReplaceDirectory,
                                        java.lang.String packageDirectory,
                                        java.lang.String[] excludes)
                                 throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • expandOneTemplate

        private void expandOneTemplate​(org.apache.velocity.app.VelocityEngine engine,
                                       java.lang.String templateName,
                                       java.io.File thisOutputDirectory,
                                       java.io.File thisDoNotReplaceDirectory,
                                       java.lang.String[] excludes,
                                       java.lang.String packageDirectory,
                                       java.lang.String key,
                                       java.lang.String value)
                                throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException