This guide highlights major changes and shows how to change a project to use new plugin.
Previously, it was possible to define default options for all executions. Now it’s mandatory to define all options for every execution.
With plugin version 6.0 configuration options were moved into sub-categories. Additionally, some of them were renamed as category has context. Documentation and meaning for these configuration options is still the same.
An execution configuration now contains following categories.
Category name | Meaning |
---|---|
|
These options tell which files to read and what encoding to produce. |
|
General class generation options. |
|
Options define how given class can be instantiated. |
|
Options to define which methods are created and which annotations are used. |
|
Options to define field type mapping (except date and time objects). |
|
Options to define date and time field generation and serialization. |
Category | Original Source Option | New option name (if changed) |
---|---|---|
|
fileExtensions |
|
fileFilter |
||
propertyWordDelimiters |
delimitersPropertyWord |
|
outputEncoding |
||
source |
||
sourceType |
||
sourceSortOrder |
||
targetVersion |
targetJavaVersion |
|
refFragmentPathDelimiters |
delimitersRefFragmentPath |
|
|
annotationStyle |
|
classNamePrefix |
namePrefix |
|
classNameSuffix |
nameSuffix |
|
customAnnotator |
customAnnotatorClass |
|
customRuleFactory |
customRuleFactoryClass |
|
includeGeneratedAnnotation |
annotateGenerated |
|
includeTypeInfo |
jackson2IncludeTypeInfo |
|
inclusionLevel |
jackson2InclusionLevel |
|
parcelable |
androidParcelable |
|
serializable |
annotateSerializable |
|
targetPackage |
||
useTitleAsClassname |
nameUseTitle |
|
|
includeAllPropertiesConstructor |
allProperties |
includeConstructorPropertiesAnnotation |
annotateConstructorProperties |
|
includeCopyConstructor |
copyConstructor |
|
includeRequiredPropertiesConstructor |
requiredProperties |
|
|
generateBuilders |
builders |
includeAdditionalProperties |
additionalProperties |
|
includeDynamicBuilders |
buildersDynamic |
|
includeDynamicGetters |
gettersDynamic |
|
includeDynamicSetters |
settersDynamic |
|
includeGetters |
getters |
|
includeHashcodeAndEquals |
hashcodeAndEquals |
|
includeJsr303Annotations |
annotateJsr303 |
|
includeJsr305Annotations |
annotateJsr305 |
|
includeSetters |
setters |
|
includeToString |
toStringMethod |
|
toStringExcludes |
||
useInnerClassBuilders |
buildersInnerClass |
|
useJakartaValidation |
annotateJsr303Jakarta |
|
useOptionalForGetters |
gettersUseOptional |
|
|
formatTypeMapping |
formatToTypeMapping |
initializeCollections |
||
useBigDecimals |
floatUseBigDecimal |
|
useBigIntegers |
integerUseBigInteger |
|
useDoubleNumbers |
floatUseDouble |
|
useLongIntegers |
integerUseLong |
|
usePrimitives |
||
|
customDatePattern |
datePattern |
customDateTimePattern |
dateTimePattern |
|
customTimePattern |
timePattern |
|
dateTimeType |
||
dateType |
||
formatDateTimes |
dateTimeFormat |
|
formatDates |
dateFormat |
|
formatTimes |
timeFormat |
|
timeType |
||
useJodaDates |
jodaDate |
|
useJodaLocalDates |
jodaLocalDate |
|
useJodaLocalTimes |
jodaLocalTime |
Name | Notes |
---|---|
removeOldOutput |
Became uncontrollable by a user in favor for Gradle to handle generated files. |
constructorsRequiredPropertiesOnly |
Can be replaced with turning off generation of any constructors except |
includeConstructors |
This option will be turned on if any constructor generation option is turned on. |
includeDynamicAccessors |
This option will be turned on if any dynamic accessor generation option is turned on. |
To set up additional processor dependencies it’s needed to add a dependency
into jsonschema2dataclassPlugins
configuration.
This could be needed for the processor to resolve:
-
Resources referenced by classpath
-
Additional types not present in standard library and direct dependencies of the processor
-
Custom RuleFactory or an Annotator for the processor
Since version 6.0 all demos are using current version of plugin to build. They were made with a thought to be re-usable and show real-world scenarios of plugin usage.