Class ExampleToModelMojo

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

    @Mojo(name="example-to-model",
          defaultPhase=GENERATE_SOURCES)
    public class ExampleToModelMojo
    extends org.apache.maven.plugin.AbstractMojo
    • Field Detail

      • FORBIDDEN_JAVA_NAMES

        private static final List<Character> FORBIDDEN_JAVA_NAMES
      • source

        @Parameter(property="johnzon.source",
                   defaultValue="${project.basedir}/src/main/johnzon")
        protected File source
      • target

        @Parameter(property="johnzon.target",
                   defaultValue="${project.build.directory}/generated-sources/johnzon")
        protected File target
      • packageBase

        @Parameter(property="johnzon.package",
                   defaultValue="com.johnzon.generated")
        protected String packageBase
      • header

        @Parameter
        protected String header
      • project

        @Parameter(defaultValue="${project}",
                   readonly=true)
        protected org.apache.maven.project.MavenProject project
      • attach

        @Parameter(property="johnzon.attach",
                   defaultValue="true")
        protected boolean attach
      • useRecord

        @Parameter(property="johnzon.useRecord",
                   defaultValue="false")
        protected boolean useRecord
      • useJsonb

        @Parameter(property="johnzon.useJsonb",
                   defaultValue="false")
        protected boolean useJsonb
      • ignoreNull

        @Parameter(property="johnzon.ignoreNull",
                   defaultValue="false")
        protected boolean ignoreNull
    • Constructor Detail

      • ExampleToModelMojo

        public ExampleToModelMojo()
    • Method Detail

      • execute

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

        private void generate​(jakarta.json.JsonReaderFactory readerFactory,
                              File source,
                              Writer writer,
                              String javaName)
                       throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • buildArrayType

        private String buildArrayType​(int arrayLevel,
                                      String type)
      • generateFile

        private void generateFile​(jakarta.json.JsonReaderFactory readerFactory,
                                  File source)
                           throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • buildValidFieldName

        private String buildValidFieldName​(String jsonField)
      • toJavaFieldName

        private String toJavaFieldName​(String key)