Package org.apache.johnzon.maven.plugin
Class ExampleToModelMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.johnzon.maven.plugin.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
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected Stringprotected booleanprotected Stringprotected org.apache.maven.project.MavenProjectprotected Fileprotected Fileprotected booleanprotected booleanFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate StringbuildArrayType(int arrayLevel, String type) private StringbuildValidFieldName(String jsonField) private Stringcapitalize(String str) voidexecute()private voidfieldGetSetMethods(Writer writer, String jsonField, String field, String type, String prefix, int arrayLevel, Collection<String> imports, boolean last) private voidprivate voidgenerateFieldsAndMethods(StringWriter writer, jakarta.json.JsonObject object, String prefix, Collection<String> imports) private voidgenerateFile(jakarta.json.JsonReaderFactory readerFactory, File source) private voidhandleArray(Writer writer, String prefix, Map<String, jakarta.json.JsonObject> nestedTypes, jakarta.json.JsonValue value, String jsonField, String fieldName, int arrayLevel, Collection<String> imports, boolean last) private StringtoJavaFieldName(String key) private StringtoJavaName(String file) private voidvisit(jakarta.json.JsonStructure structure, ExampleToModelMojo.Visitor visitor) Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
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
-
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 Details
-
ExampleToModelMojo
public ExampleToModelMojo()
-
-
Method Details
-
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
-
generateFieldsAndMethods
private void generateFieldsAndMethods(StringWriter writer, jakarta.json.JsonObject object, String prefix, Collection<String> imports) throws IOException - Throws:
IOException
-
handleArray
private void handleArray(Writer writer, String prefix, Map<String, jakarta.json.JsonObject> nestedTypes, jakarta.json.JsonValue value, String jsonField, String fieldName, int arrayLevel, Collection<String> imports, boolean last) throws IOException- Throws:
IOException
-
fieldGetSetMethods
private void fieldGetSetMethods(Writer writer, String jsonField, String field, String type, String prefix, int arrayLevel, Collection<String> imports, boolean last) throws IOException - Throws:
IOException
-
capitalize
-
buildArrayType
-
visit
-
generateFile
private void generateFile(jakarta.json.JsonReaderFactory readerFactory, File source) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
buildValidFieldName
-
toJavaFieldName
-
toJavaName
-