public class Jsonschema2PojoTask extends org.apache.tools.ant.Task implements GenerationConfig
Constructor and Description |
---|
Jsonschema2PojoTask() |
Modifier and Type | Method and Description |
---|---|
org.apache.tools.ant.types.Path |
createClasspath() |
void |
execute()
Execute this task (it's expected that all relevant setters will have been
called by Ant to provide task configuration before this method
is called).
|
AnnotationStyle |
getAnnotationStyle()
Gets the 'annotationStyle' configuration option.
|
String |
getClassNamePrefix()
Gets the 'getClassNamePrefix' configuration option.
|
String |
getClassNameSuffix()
Gets the 'getClassNameSuffix' configuration option.
|
org.apache.tools.ant.types.Path |
getClasspath() |
Class<? extends Annotator> |
getCustomAnnotator()
Gets the 'customAnnotator' configuration option.
|
String |
getCustomDatePattern()
Gets the 'customDatePattern' configuration option
|
String |
getCustomDateTimePattern()
Gets the 'customDateTimePattern' configuration option
|
Class<? extends RuleFactory> |
getCustomRuleFactory()
Gets the 'customRuleFactory' configuration option.
|
String |
getCustomTimePattern()
Gets the 'customTimePattern' configuration option
|
String |
getDateTimeType()
Gets the `dateTimeType` configuration option.
|
String |
getDateType()
Gets the `dateType` configuration option.
|
String[] |
getFileExtensions()
Gets the 'fileExtensions' configuration option.
|
FileFilter |
getFileFilter()
Gets the file filter used to isolate the schema mapping files in the
source directories.
|
Map<String,String> |
getFormatTypeMapping()
Gets the 'formatTypeMapping' configuration option.
|
InclusionLevel |
getInclusionLevel()
Gets the 'inclusionLevel' option for Jackson serializer.
|
String |
getOutputEncoding()
Gets the 'outputEncoding' configuration option.
|
char[] |
getPropertyWordDelimiters()
Gets the 'propertyWordDelimiters' configuration option.
|
String |
getRefFragmentPathDelimiters()
Gets the `refFragmentPathDelimiters` configuration option.
|
Iterator<URL> |
getSource()
Gets the 'source' configuration option.
|
SourceSortOrder |
getSourceSortOrder()
Gets the 'sourceSortOrder' configuration option.
|
SourceType |
getSourceType()
Gets the 'sourceType' configuration option.
|
File |
getTargetDirectory()
Gets the 'targetDirectory' configuration option.
|
String |
getTargetPackage()
Gets the 'targetPackage' configuration option.
|
String |
getTargetVersion()
Gets the 'targetVersion' configuration option.
|
String |
getTimeType()
Gets the `timeType` configuration option.
|
String[] |
getToStringExcludes()
Gets the 'toStringExcludes' configuration option.
|
boolean |
isConstructorsRequiredPropertiesOnly()
Gets the 'constructorsRequiredPropertiesOnly' configuration option.
|
boolean |
isFormatDates()
Gets the `formatDates` configuration option
|
boolean |
isFormatDateTimes()
Gets the `formatDateTime` configuration option
|
boolean |
isFormatTimes()
Gets the `formatTimes` configuration option
|
boolean |
isGenerateBuilders()
Gets the 'generateBuilders' configuration option.
|
boolean |
isIncludeAdditionalProperties()
Gets the 'includeAdditionalProperties' configuration option.
|
boolean |
isIncludeAllPropertiesConstructor()
Gets the 'constructorsIncludeRequiredPropertiesConstructor' configuration option.
|
boolean |
isIncludeConstructorPropertiesAnnotation()
Gets the 'includeConstructorPropertiesAnnotation' configuration option.
|
boolean |
isIncludeConstructors()
Gets the 'includeConstructors' configuration option.
|
boolean |
isIncludeCopyConstructor()
Gets the 'constructorsIncludeRequiredPropertiesConstructor' configuration option.
|
boolean |
isIncludeDynamicAccessors()
Gets the `includeDynamicAccessors` configuration option
|
boolean |
isIncludeDynamicBuilders()
Gets the `includeDynamicBuilders` configuration option.
|
boolean |
isIncludeDynamicGetters()
Gets the `includeDynamicGetters` configuration option.
|
boolean |
isIncludeDynamicSetters()
Gets the `includeDynamicSetters` configuration option.
|
boolean |
isIncludeGeneratedAnnotation()
Whether to mark generated classes with the annotation
javax.annotation.@Generated |
boolean |
isIncludeGetters()
Gets the 'includeGetters' configuration option.
|
boolean |
isIncludeHashcodeAndEquals()
Gets the 'includeHashcodeAndEquals' configuration option.
|
boolean |
isIncludeJsr303Annotations()
Gets the 'includeJsr303Annotations' configuration option.
|
boolean |
isIncludeJsr305Annotations()
Gets the 'includeJsr305Annotations' configuration option.
|
boolean |
isIncludeRequiredPropertiesConstructor()
Gets the 'constructorsIncludeRequiredPropertiesConstructor' configuration option.
|
boolean |
isIncludeSetters()
Gets the 'includeSetters' configuration option.
|
boolean |
isIncludeToString()
Gets the 'includeToString' configuration option.
|
boolean |
isIncludeTypeInfo()
Gets the 'includeTypeInfo' configuration option.
|
boolean |
isInitializeCollections()
Gets the 'initializeCollections' configuration option.
|
boolean |
isParcelable()
Gets the 'parcelable' configuration option.
|
boolean |
isRemoveOldOutput()
Gets the 'removeOldOutput' configuration option.
|
boolean |
isSerializable()
Gets the 'serializable' configuration option.
|
boolean |
isSkip()
Should this task be skipped? (don't read schemas, don't generate types)
|
boolean |
isUseBigDecimals()
Gets the 'useBigDecimals' configuration option.
|
boolean |
isUseBigIntegers()
Gets the 'useBigIntegers' configuration option.
|
boolean |
isUseDoubleNumbers()
Gets the 'useDoubleNumbers' configuration option.
|
boolean |
isUseInnerClassBuilders()
If set to true, then the gang of four builder pattern will be used to generate builders on generated classes.
|
boolean |
isUseJakartaValidation()
Gets the 'useJakartaValidation' configuration option.
|
boolean |
isUseJodaDates()
Gets the 'useJodaDates' configuration option.
|
boolean |
isUseJodaLocalDates()
Gets the 'useJodaLocalDates' configuration option.
|
boolean |
isUseJodaLocalTimes()
Gets the 'useJodaLocalTimes' configuration option.
|
boolean |
isUseLongIntegers()
Gets the 'useLongIntegers' configuration option.
|
boolean |
isUseOptionalForGetters()
Gets the 'useOptionalForGetters' configuration option.
|
boolean |
isUsePrimitives()
Gets the 'usePrimitives' configuration option.
|
boolean |
isUseTitleAsClassname()
When
true the title is used as class name. |
void |
setAnnotationStyle(AnnotationStyle annotationStyle)
Sets the 'annotationStyle' property of this class
|
void |
setClassNamePrefix(String classNamePrefix)
Sets the 'classNamePrefix' property of this class
|
void |
setClassNameSuffix(String classNameSuffix)
Sets the 'classNameSuffix' property of this class
|
void |
setClasspath(org.apache.tools.ant.types.Path classpath) |
void |
setClasspathRef(org.apache.tools.ant.types.Reference classpathRef) |
void |
setConstructorsRequiredPropertiesOnly(boolean constructorsRequiredPropertiesOnly)
Sets the 'constructorsRequiredPropertiesOnly' property of this class.
|
void |
setCustomAnnotator(String customAnnotator)
Sets the 'customAnnotator' property of this class
|
void |
setCustomDatePattern(String customDatePattern)
Sets the 'customDatePattern' property of this class
|
void |
setCustomDateTimePattern(String customDateTimePattern)
Sets the 'customDateTimePattern' property of this class
|
void |
setCustomRuleFactory(String customRuleFactory) |
void |
setCustomTimePattern(String customTimePattern)
Sets the 'customTimePattern' property of this class
|
void |
setFileExtensions(String[] fileExtensions)
Sets the 'fileExtensions' property of this class
|
void |
setFormatDates(boolean formatDates)
Sets the 'formatDates' property of this class
|
void |
setFormatDateTime(boolean formatDateTimes)
Sets the 'formatDateTimes' property of this class
|
void |
setFormatTimes(boolean formatTimes)
Sets the 'formatTimes' property of this class
|
void |
setFormatTypeMapping(Map<String,String> formatTypeMapping) |
void |
setFormatTypeMapping(String[] formatTypeMapping) |
void |
setGenerateBuilders(boolean generateBuilders)
Sets the 'generateBuilders' property of this class.
|
void |
setIncludeAdditionalProperties(boolean includeAdditionalProperties)
Sets the 'includeAdditionalProperties' property of this class
|
void |
setIncludeAllPropertiesConstructor(boolean includeAllPropertiesConstructor)
Sets the 'constructorsIncludeRequiredPropertiesConstructor' configuration option.
|
void |
setIncludeConstructorPropertiesAnnotation(boolean includeConstructorPropertiesAnnotation)
Sets the 'includeConstructorPropertiesAnnotation' property of this class
|
void |
setIncludeConstructors(boolean includeConstructors)
Sets the 'includeConstructors' property of this class
|
void |
setIncludeCopyConstructor(boolean includeCopyConstructor)
Sets the 'constructorsIncludeRequiredPropertiesConstructor' configuration option.
|
void |
setIncludeDynamicAccessors(boolean includeDynamicAccessors)
Sets the 'includeDynamicAccessors' property of this class
|
void |
setIncludeDynamicBuilders(boolean includeDynamicBuilders)
Sets the 'includeDynamicBuilders' property of this class
|
void |
setIncludeDynamicGetters(boolean includeDynamicGetters)
Sets the 'includeDynamicGetters' property of this class
|
void |
setIncludeDynamicSetters(boolean includeDynamicSetters)
Sets the 'includeDynamicSetters' property of this class
|
void |
setIncludeGetters(boolean includeGetters)
Sets the 'includeGetters' property of this class
|
void |
setIncludeHashcodeAndEquals(boolean includeHashcodeAndEquals)
Sets the 'includeHashcodeAndEquals' property of this class
|
void |
setIncludeJsr303Annotations(boolean includeJsr303Annotations)
Sets the 'includeJsr303Annotations' property of this class
|
void |
setIncludeJsr305Annotations(boolean includeJsr305Annotations)
Sets the 'includeJsr305Annotations' property of this class
|
void |
setIncludeRequiredPropertiesConstructor(boolean includeRequiredPropertiesConstructor)
Sets the 'constructorsIncludeRequiredPropertiesConstructor' configuration option.
|
void |
setIncludeSetters(boolean includeSetters)
Sets the 'includeSetters' property of this class
|
void |
setIncludeToString(boolean includeToString)
Sets the 'includeToString' property of this class
|
void |
setIncludeTypeInfo(boolean includeTypeInfo)
Sets the 'includeTypeInfo' property of this class.
|
void |
setInclusionLevel(InclusionLevel inclusionLevel)
Sets the 'inclusionLevel' property of this class
|
void |
setInitializeCollections(boolean initializeCollections)
Sets the 'initializeCollections' property of this class
|
void |
setOutputEncoding(String outputEncoding)
Sets the 'outputEncoding' property of this class
|
void |
setParcelable(boolean parcelable)
Sets the 'parcelable' property of this class
|
void |
setPropertyWordDelimiters(String propertyWordDelimiters) |
void |
setRefFragmentPathDelimiters(String refFragmentPathDelimiters)
Sets the 'refFragmentPathDelimiters' property of this class
|
void |
setRemoveOldOutput(boolean removeOldOutput)
Sets the 'removeOldOutput' property of this class
|
void |
setSerializable(boolean serializable)
Sets the 'serializable' property of this class
|
void |
setSkip(boolean skip)
Sets the 'skip' property of this task.
|
void |
setSource(String source)
Sets schema file (or directory containing schema files) that should be
used for input.
|
void |
setSourceSortOrder(SourceSortOrder sourceSortOrder)
Sets the 'sourceSortOrder' property of this class
|
void |
setSourceType(SourceType sourceType)
Sets the 'sourceType' property of this class
|
void |
setTargetDirectory(File targetDirectory)
Sets the target (output) directory for generated source files.
|
void |
setTargetPackage(String targetPackage)
Sets the target package for generated types.
|
void |
setTargetVersion(String targetVersion)
Sets the 'targetVersion' property of this class
|
void |
setUseBigDecimals(boolean useBigDecimals)
Sets the 'useBigDecimals' property of this class
|
void |
setUseBigIntegers(boolean useBigIntegers)
Sets the 'useBigIntegers' property of this class.
|
void |
setUseCommonsLang3(boolean useCommonsLang3)
Sets the 'useCommonsLang3' property of this class
|
void |
setUseDoubleNumbers(boolean useDoubleNumbers)
Sets the 'useDoubleNumbers' property of this class
|
void |
setUseInnerClassBuilders(boolean useInnerClassBuilders)
Sets the 'useInnerClassBuilders' property of this class
|
void |
setUseJakartaValidation(boolean useJakartaValidation)
Sets the 'useJakartaValidation' property of this class
|
void |
setUseJodaDates(boolean useJodaDates)
Sets the 'useJodaDates' property of this class
|
void |
setUseJodaLocalDates(boolean useJodaLocalDates)
Sets the 'useJodaLocalDates' property of this class
|
void |
setUseJodaLocalTimes(boolean useJodaLocalTimes)
Sets the 'useJodaLocalTimes' property of this class
|
void |
setUseLongIntegers(boolean useLongIntegers)
Sets the 'useLongIntegers' property of this class
|
void |
setUseOptionalForGetters(boolean useOptionalForGetters)
Sets the 'useOptionalForGetters' property of this class
|
void |
setUsePrimitives(boolean usePrimitives)
Sets the 'usePrimitives' property of this class.
|
void |
setUseTitleAsClassname(boolean useTitleAsClassname)
Sets whether to use the title as classname.
|
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
public void execute() throws org.apache.tools.ant.BuildException
execute
in class org.apache.tools.ant.Task
org.apache.tools.ant.BuildException
- if this task cannot be completed due to some error reading
schemas, generating types or writing output .java files.public void setIncludeConstructors(boolean includeConstructors)
includeConstructors
- Whether to generate constructors or not.public void setConstructorsRequiredPropertiesOnly(boolean constructorsRequiredPropertiesOnly)
isIncludeAllPropertiesConstructor()
and off the isIncludeAllPropertiesConstructor()
configuration options. It
is specifically tied to the isIncludeConstructors()
property, and will do nothing if that property is not enabledconstructorsRequiredPropertiesOnly
- controls whether the resulting class will have only the constructor with required properties or
something elsepublic void setIncludeRequiredPropertiesConstructor(boolean includeRequiredPropertiesConstructor)
isIncludeConstructors()
configuration option and is incompatible with isConstructorsRequiredPropertiesOnly()
, and will have no effect
if isIncludeConstructors()
is not set to true. If isIncludeConstructors()
is set to true then this configuration determines
whether the resulting object should include a constructor with only the required properties as parameters.includeRequiredPropertiesConstructor
- controls whether the resulting class will include a constructor which takes in only
required propertiespublic void setIncludeAllPropertiesConstructor(boolean includeAllPropertiesConstructor)
isIncludeConstructors()
configuration option and is incompatible with isConstructorsRequiredPropertiesOnly()
, and will have no effect
if isIncludeConstructors()
is not set to true. If isIncludeConstructors()
is set to true then this configuration determines
whether the resulting object should include a constructor with all listed properties as parameters.includeAllPropertiesConstructor
- controls whether the resulting class will include a constructor which takes in all available
properties of the classpublic void setIncludeCopyConstructor(boolean includeCopyConstructor)
isIncludeConstructors()
configuration option and is incompatible with isConstructorsRequiredPropertiesOnly()
, and will have no effect
if isIncludeConstructors()
is not set to true. If isIncludeConstructors()
is set to true then this configuration determines
whether the resulting object should include a constructor the class itself as a parameter, with the expectation that all properties from the
originating class will assigned to the new class.includeCopyConstructor
- controls whether the resulting class will include a constructor which takes in an instance of the class
to be shallow copied into the new instancepublic void setGenerateBuilders(boolean generateBuilders)
generateBuilders
- Whether to generate builder-style methods of the form
withXxx(value)
(that return this
),
alongside the standard, void-return setters.
Default: false
.
public void setIncludeTypeInfo(boolean includeTypeInfo)
includeTypeInfo
- Whether to use include json type info information to class. Often required to support polymorphic type deserialization.
By default the type information is stored in the @class property, this can be overridden in the deserializationClassProperty of the schema.
Default: false
.
public void setUsePrimitives(boolean usePrimitives)
usePrimitives
- Whether to use primitives (long
,
double
, boolean
) instead of wrapper
types where possible when generating bean properties (has the
side-effect of making those properties non-null).
Default: false
.
public void setUseLongIntegers(boolean useLongIntegers)
public void setUseBigIntegers(boolean useBigIntegers)
useBigIntegers
- Whether to use the java type BigInteger
instead of int
(or Integer
)
when representing the JSON Schema type 'integer'. Note that
this configuration overrides isUseLongIntegers()
.public void setUseDoubleNumbers(boolean useDoubleNumbers)
public void setUseBigDecimals(boolean useBigDecimals)
useBigDecimals
- Whether to use the java type BigDecimal
instead of float
(or Float
)
when representing the JSON Schema type 'number'. Note that
this configuration overrides isUseDoubleNumbers()
.public void setSource(String source)
source
- Location of the JSON Schema file(s). Note: this may refer to a
single file or a directory of files.public void setTargetDirectory(File targetDirectory)
targetDirectory
- Target directory for generated Java source files.public void setTargetPackage(String targetPackage)
targetPackage
- Package name used for generated Java classes (for types where
a fully qualified name has not been supplied in the schema
using the 'javaType' property).public void setSkip(boolean skip)
skip
- whether to skip execution of this taskpublic void setPropertyWordDelimiters(String propertyWordDelimiters)
propertyWordDelimiters
- a string containing all of the characters that should be
considered as word delimiters when creating Java Bean property
names from JSON property names. If blank or not set, JSON
properties will be considered to contain a single word when
creating Java Bean property names.public void setIncludeHashcodeAndEquals(boolean includeHashcodeAndEquals)
includeHashcodeAndEquals
- Whether to include hashCode
and
equals
methods in generated Java types.public void setIncludeToString(boolean includeToString)
includeToString
- Whether to include a toString
method in generated
Java types.public void setAnnotationStyle(AnnotationStyle annotationStyle)
annotationStyle
- The style of annotations to use in the generated Java types.public void setUseTitleAsClassname(boolean useTitleAsClassname)
useTitleAsClassname
- When true
, derive the classname from title.public void setInclusionLevel(InclusionLevel inclusionLevel)
inclusionLevel
- The level of inclusion for Jackson serializer.public void setCustomAnnotator(String customAnnotator)
customAnnotator
- A custom annotator to use to annotate the generated typespublic void setCustomRuleFactory(String customRuleFactory)
public void setIncludeJsr303Annotations(boolean includeJsr303Annotations)
includeJsr303Annotations
- Whether to include
JSR-303
annotations (for schema rules like minimum, maximum, etc) in
generated Java types.public void setIncludeJsr305Annotations(boolean includeJsr305Annotations)
includeJsr305Annotations
- Whether to include
JSR-305
annotations (for schema rules like Nullable, NonNull, etc) in
generated Java types.public void setUseOptionalForGetters(boolean useOptionalForGetters)
useOptionalForGetters
- Whether to use Optional
as return type for
getters of non-required fields.public void setSourceType(SourceType sourceType)
sourceType
- The type of input documents that will be read
Supported values:
jsonschema
json
yamlschema
yaml
public void setRemoveOldOutput(boolean removeOldOutput)
removeOldOutput
- Whether to empty the target directory before generation
occurs, to clear out all source files that have been generated
previously. Be warned, when activated this
option will cause jsonschema2pojo to indiscriminately
delete the entire contents of the target directory (all files
and folders) before it begins generating sources.public void setOutputEncoding(String outputEncoding)
outputEncoding
- The character encoding that should be used when writing the
generated Java source filespublic void setIncludeConstructorPropertiesAnnotation(boolean includeConstructorPropertiesAnnotation)
includeConstructorPropertiesAnnotation
- Determines if constructors will be annotated with JDK-provided ConstructorProperties annotation. (Not Available on Android)public void setUseJodaDates(boolean useJodaDates)
useJodaDates
- Whether to use DateTime
instead of
Date
when adding date type fields to
generated Java types.public void setUseJodaLocalDates(boolean useJodaLocalDates)
useJodaLocalDates
- Whether to use LocalDate
instead of
string when adding string fields of format date (not
date-time) to generated Java types.public void setUseJodaLocalTimes(boolean useJodaLocalTimes)
useJodaLocalTimes
- Whether to use LocalTime
instead of
string when adding string fields of format time (not
date-time) to generated Java types.public void setUseCommonsLang3(boolean useCommonsLang3)
useCommonsLang3
- public void setParcelable(boolean parcelable)
parcelable
- Whether to make the generated types 'parcelable' (for Android
development).public void setSerializable(boolean serializable)
serializable
- Whether to make the generated types 'serializable'.public void setInitializeCollections(boolean initializeCollections)
initializeCollections
- Whether to initialize collections with empty instance or null.public void setClassNamePrefix(String classNamePrefix)
classNamePrefix
- Whether to add a prefix to generated classes.public void setClassNameSuffix(String classNameSuffix)
classNameSuffix
- Whether to add a suffix to generated classes.public void setFileExtensions(String[] fileExtensions)
fileExtensions
- The array of strings that should be considered as file
extensions and therefore not included in class names.public void setIncludeAdditionalProperties(boolean includeAdditionalProperties)
includeAdditionalProperties
- Whether to allow 'additional properties' support in objects.
Setting this to false will disable additional properties
support, regardless of the input schema(s).public void setIncludeGetters(boolean includeGetters)
includeGetters
- Whether to include getters or to omit these accessor
methods and create public fields instead.public void setIncludeSetters(boolean includeSetters)
includeSetters
- Whether to include setters or to omit these accessor
methods and create public fields instead.public void setTargetVersion(String targetVersion)
targetVersion
- The target version for generated source files.
Default: 1.6
.
public void setIncludeDynamicAccessors(boolean includeDynamicAccessors)
includeDynamicAccessors
- Whether to include dynamic getters, setters, and builders or to omit these methods.public void setIncludeDynamicGetters(boolean includeDynamicGetters)
includeDynamicGetters
- Whether to include dynamic getters or to omit these methods.public void setIncludeDynamicSetters(boolean includeDynamicSetters)
includeDynamicSetters
- Whether to include dynamic setters or to omit these methods.public void setIncludeDynamicBuilders(boolean includeDynamicBuilders)
includeDynamicBuilders
- Whether to include dynamic builders or to omit these methods.public void setFormatDateTime(boolean formatDateTimes)
formatDateTimes
- Whether the fields of type date-type
have the @JsonFormat
annotation
with pattern set to the default value of yyyy-MM-dd'T'HH:mm:ss.SSS
and timezone set to default value of `UTC`public void setFormatTimes(boolean formatTimes)
formatTimes
- Whether the fields of type time
have the @JsonFormat
annotation
with pattern set to the default value of HH:mm:ss.SSS
.public void setFormatDates(boolean formatDates)
formatDates
- Whether the fields of type date
have the @JsonFormat
annotation
with pattern set to the default value of yyyy-MM-dd
.public void setCustomDatePattern(String customDatePattern)
customDatePattern
- A custom pattern to use when formatting date fields during
serialization. Requires support from your JSON binding
library.public void setCustomTimePattern(String customTimePattern)
customTimePattern
- A custom pattern to use when formatting time fields during
serialization. Requires support from your JSON binding
library.public void setCustomDateTimePattern(String customDateTimePattern)
customDateTimePattern
- A custom pattern to use when formatting date-time fields during
serialization. Requires support from your JSON binding
library.public void setRefFragmentPathDelimiters(String refFragmentPathDelimiters)
refFragmentPathDelimiters
- A string containing any characters that should act as path delimiters when
resolving $ref fragments. By default, #, / and . are used in an attempt
to support JSON Pointer and JSON Path.public void setSourceSortOrder(SourceSortOrder sourceSortOrder)
sourceSortOrder
- Sets the sort order for the source files to be processed in. By default the OS can
influence the processing order.public void setUseInnerClassBuilders(boolean useInnerClassBuilders)
useInnerClassBuilders
- determines whether builders will be chainable setters or embedded classes when isGenerateBuilders()
usedpublic void setUseJakartaValidation(boolean useJakartaValidation)
useJakartaValidation
- Whether to use annotations from jakarta.validation
package instead of javax.validation
package
when adding JSR-303 annotations to generated Java types.public void setFormatTypeMapping(String[] formatTypeMapping)
public boolean isGenerateBuilders()
GenerationConfig
isGenerateBuilders
in interface GenerationConfig
withXxx(value)
(that return this
),
alongside the standard, void-return setters.public boolean isIncludeTypeInfo()
GenerationConfig
isIncludeTypeInfo
in interface GenerationConfig
public boolean isUsePrimitives()
GenerationConfig
isUsePrimitives
in interface GenerationConfig
long
, double
, boolean
) instead of wrapper types where possible
when generating bean properties (has the side-effect of making
those properties non-null).public Iterator<URL> getSource()
GenerationConfig
getSource
in interface GenerationConfig
public File getTargetDirectory()
GenerationConfig
getTargetDirectory
in interface GenerationConfig
public String getTargetPackage()
GenerationConfig
getTargetPackage
in interface GenerationConfig
public char[] getPropertyWordDelimiters()
GenerationConfig
getPropertyWordDelimiters
in interface GenerationConfig
public boolean isSkip()
true
if this task is disabledpublic boolean isUseLongIntegers()
GenerationConfig
isUseLongIntegers
in interface GenerationConfig
long
(or
Long
) instead of int
(or
Integer
) when representing the JSON Schema type
'integer'.public boolean isUseDoubleNumbers()
GenerationConfig
isUseDoubleNumbers
in interface GenerationConfig
double
(or
Double
) instead of float
(or
Float
) when representing the JSON Schema type
'number'.public boolean isIncludeHashcodeAndEquals()
GenerationConfig
isIncludeHashcodeAndEquals
in interface GenerationConfig
hashCode
and
equals
methods in generated Java types.public boolean isIncludeToString()
GenerationConfig
isIncludeToString
in interface GenerationConfig
toString
method in
generated Java types.public String[] getToStringExcludes()
GenerationConfig
getToStringExcludes
in interface GenerationConfig
public AnnotationStyle getAnnotationStyle()
GenerationConfig
getAnnotationStyle
in interface GenerationConfig
Supported values:
jackson
(alias for jackson2)
jackson2
(apply annotations from the
Jackson 2.x library)gson
(apply annotations from the
gson
library)moshi1
(apply annotations from the
moshi library)none
(apply no annotations at all)AnnotatorFactory
public boolean isUseTitleAsClassname()
GenerationConfig
true
the title is used as class name.isUseTitleAsClassname
in interface GenerationConfig
public InclusionLevel getInclusionLevel()
GenerationConfig
getInclusionLevel
in interface GenerationConfig
Supported values
ALWAYS
NON_ABSENT
NON_DEFAULT
NON_EMPTY
NON_NULL
USE_DEFAULTS
InclusionLevel
public Class<? extends Annotator> getCustomAnnotator()
GenerationConfig
getCustomAnnotator
in interface GenerationConfig
GenerationConfig.getAnnotationStyle()
public Class<? extends RuleFactory> getCustomRuleFactory()
GenerationConfig
getCustomRuleFactory
in interface GenerationConfig
public boolean isIncludeJsr303Annotations()
GenerationConfig
isIncludeJsr303Annotations
in interface GenerationConfig
public boolean isIncludeJsr305Annotations()
GenerationConfig
isIncludeJsr305Annotations
in interface GenerationConfig
public boolean isUseOptionalForGetters()
GenerationConfig
isUseOptionalForGetters
in interface GenerationConfig
Optional
as return type for
getters of non-required fields.public SourceType getSourceType()
GenerationConfig
getSourceType
in interface GenerationConfig
Supported values:
jsonschema
json
public org.apache.tools.ant.types.Path createClasspath()
public void setClasspath(org.apache.tools.ant.types.Path classpath)
public void setClasspathRef(org.apache.tools.ant.types.Reference classpathRef)
public org.apache.tools.ant.types.Path getClasspath()
public boolean isRemoveOldOutput()
GenerationConfig
isRemoveOldOutput
in interface GenerationConfig
public String getOutputEncoding()
GenerationConfig
getOutputEncoding
in interface GenerationConfig
public boolean isUseJodaDates()
GenerationConfig
isUseJodaDates
in interface GenerationConfig
DateTime
instead of
Date
when adding date type fields to generated
Java types.public boolean isUseJodaLocalDates()
GenerationConfig
isUseJodaLocalDates
in interface GenerationConfig
LocalDate
instead of string
when adding string type fields with a format of date (not
date-time) to generated Java types.public boolean isUseJodaLocalTimes()
GenerationConfig
isUseJodaLocalTimes
in interface GenerationConfig
LocalTime
instead of string
when adding string type fields with a format of time (not
date-time) to generated Java types.public boolean isParcelable()
GenerationConfig
isParcelable
in interface GenerationConfig
public boolean isSerializable()
GenerationConfig
isSerializable
in interface GenerationConfig
public FileFilter getFileFilter()
GenerationConfig
getFileFilter
in interface GenerationConfig
public boolean isInitializeCollections()
GenerationConfig
isInitializeCollections
in interface GenerationConfig
public String getClassNamePrefix()
GenerationConfig
getClassNamePrefix
in interface GenerationConfig
public String getClassNameSuffix()
GenerationConfig
getClassNameSuffix
in interface GenerationConfig
public String[] getFileExtensions()
GenerationConfig
getFileExtensions
in interface GenerationConfig
public boolean isIncludeConstructors()
GenerationConfig
isIncludeConstructors
in interface GenerationConfig
public boolean isConstructorsRequiredPropertiesOnly()
GenerationConfig
GenerationConfig.isIncludeAllPropertiesConstructor()
and off the GenerationConfig.isIncludeAllPropertiesConstructor()
configuration options.
It is specifically tied to the GenerationConfig.isIncludeConstructors()
property, and will do nothing if that property is not enabledisConstructorsRequiredPropertiesOnly
in interface GenerationConfig
public boolean isIncludeRequiredPropertiesConstructor()
GenerationConfig
GenerationConfig.isIncludeConstructors()
configuration option and is incompatible with GenerationConfig.isConstructorsRequiredPropertiesOnly()
, and will have no effect
if GenerationConfig.isIncludeConstructors()
is not set to true. If GenerationConfig.isIncludeConstructors()
is set to true then this configuration determines
whether the resulting object should include a constructor with only the required properties as parameters.isIncludeRequiredPropertiesConstructor
in interface GenerationConfig
public boolean isIncludeAllPropertiesConstructor()
GenerationConfig
GenerationConfig.isIncludeConstructors()
configuration option and is incompatible with GenerationConfig.isConstructorsRequiredPropertiesOnly()
, and will have no effect
if GenerationConfig.isIncludeConstructors()
is not set to true. If GenerationConfig.isIncludeConstructors()
is set to true then this configuration determines
whether the resulting object should include a constructor with all listed properties as parameters.isIncludeAllPropertiesConstructor
in interface GenerationConfig
public boolean isIncludeCopyConstructor()
GenerationConfig
GenerationConfig.isIncludeConstructors()
configuration option and is incompatible with GenerationConfig.isConstructorsRequiredPropertiesOnly()
, and will have no effect
if GenerationConfig.isIncludeConstructors()
is not set to true. If GenerationConfig.isIncludeConstructors()
is set to true then this configuration determines
whether the resulting object should include a constructor the class itself as a parameter, with the expectation that all properties from the
originating class will assigned to the new class.isIncludeCopyConstructor
in interface GenerationConfig
public boolean isIncludeAdditionalProperties()
GenerationConfig
isIncludeAdditionalProperties
in interface GenerationConfig
public boolean isIncludeGetters()
GenerationConfig
isIncludeGetters
in interface GenerationConfig
public boolean isIncludeSetters()
GenerationConfig
isIncludeSetters
in interface GenerationConfig
public String getTargetVersion()
GenerationConfig
getTargetVersion
in interface GenerationConfig
public boolean isIncludeDynamicAccessors()
GenerationConfig
isIncludeDynamicAccessors
in interface GenerationConfig
public boolean isIncludeDynamicGetters()
GenerationConfig
isIncludeDynamicGetters
in interface GenerationConfig
public boolean isIncludeDynamicSetters()
GenerationConfig
isIncludeDynamicSetters
in interface GenerationConfig
public boolean isIncludeDynamicBuilders()
GenerationConfig
isIncludeDynamicBuilders
in interface GenerationConfig
public String getDateTimeType()
GenerationConfig
Example values:
org.joda.time.LocalDateTime
(Joda)java.time.LocalDateTime
(JSR310)null
(default behavior)getDateTimeType
in interface GenerationConfig
Date
when
adding date type fields to generate Java types.public String getDateType()
GenerationConfig
Example values:
org.joda.time.LocalDate
(Joda)java.time.LocalDate
(JSR310)null
(default behavior)getDateType
in interface GenerationConfig
public String getTimeType()
GenerationConfig
Example values:
org.joda.time.LocalTime
(Joda)java.time.LocalTime
(JSR310)null
(default behavior)getTimeType
in interface GenerationConfig
public boolean isUseBigIntegers()
GenerationConfig
isUseBigIntegers
in interface GenerationConfig
BigInteger
instead
of int
(or Integer
) when
representing the JSON Schema type 'integer'. Note that this
configuration overrides GenerationConfig.isUseLongIntegers()
.public boolean isUseBigDecimals()
GenerationConfig
isUseBigDecimals
in interface GenerationConfig
BigDecimal
instead
of float
(or Float
) when
representing the JSON Schema type 'number'. Note that this
configuration overrides GenerationConfig.isUseDoubleNumbers()
.public boolean isFormatDateTimes()
GenerationConfig
isFormatDateTimes
in interface GenerationConfig
date-type
have the
@JsonFormat
annotation with pattern set to the
default value of yyyy-MM-dd'T'HH:mm:ss.SSSZ
public boolean isFormatDates()
GenerationConfig
isFormatDates
in interface GenerationConfig
date
have the
@JsonFormat
annotation with pattern set to the
default value of yyyy-MM-dd
public boolean isFormatTimes()
GenerationConfig
isFormatTimes
in interface GenerationConfig
time
have the
@JsonFormat
annotation with pattern set to the
default value of HH:mm:ss.SSS
public String getCustomDatePattern()
GenerationConfig
getCustomDatePattern
in interface GenerationConfig
public String getCustomTimePattern()
GenerationConfig
getCustomTimePattern
in interface GenerationConfig
public String getCustomDateTimePattern()
GenerationConfig
getCustomDateTimePattern
in interface GenerationConfig
public String getRefFragmentPathDelimiters()
GenerationConfig
getRefFragmentPathDelimiters
in interface GenerationConfig
public SourceSortOrder getSourceSortOrder()
GenerationConfig
getSourceSortOrder
in interface GenerationConfig
Supported values:
OS
(Let the OS influence the order the source files are processed.)FILES_FIRST
(Case sensitive sort, visit the files first. The source files are processed in a breadth
first sort order.)SUBDIRS_FIRST
(Case sensitive sort, visit the sub-directories before the files. The source files are
processed in a depth first sort order.)public Map<String,String> getFormatTypeMapping()
GenerationConfig
getFormatTypeMapping
in interface GenerationConfig
public boolean isUseInnerClassBuilders()
GenerationConfig
GenerationConfig.isGenerateBuilders()
method. If the GenerationConfig.isGenerateBuilders()
is false,
then this property will not do anything.isUseInnerClassBuilders
in interface GenerationConfig
public boolean isIncludeConstructorPropertiesAnnotation()
GenerationConfig
isIncludeConstructorPropertiesAnnotation
in interface GenerationConfig
public boolean isIncludeGeneratedAnnotation()
GenerationConfig
javax.annotation.@Generated
isIncludeGeneratedAnnotation
in interface GenerationConfig
public boolean isUseJakartaValidation()
GenerationConfig
GenerationConfig.isIncludeJsr303Annotations()
configuration option.
If the GenerationConfig.isIncludeJsr303Annotations()
returns false
, then this configuration option will not affect anything.isUseJakartaValidation
in interface GenerationConfig
jakarta.validation
package instead of javax.validation
package when adding JSR-303 annotations to generated Java typesCopyright © 2022. All rights reserved.