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() |
String |
getClassNamePrefix() |
String |
getClassNameSuffix() |
org.apache.tools.ant.types.Path |
getClasspath() |
Class<? extends Annotator> |
getCustomAnnotator() |
String |
getCustomDatePattern() |
String |
getCustomDateTimePattern() |
Class<? extends RuleFactory> |
getCustomRuleFactory() |
String |
getDateTimeType() |
String |
getDateType() |
String[] |
getFileExtensions() |
FileFilter |
getFileFilter() |
InclusionLevel |
getInclusionLevel() |
String |
getOutputEncoding() |
char[] |
getPropertyWordDelimiters() |
String |
getRefFragmentPathDelimiters() |
Iterator<URL> |
getSource() |
SourceSortOrder |
getSourceSortOrder() |
SourceType |
getSourceType() |
File |
getTargetDirectory() |
String |
getTargetPackage() |
String |
getTargetVersion() |
String |
getTimeType() |
String[] |
getToStringExcludes() |
boolean |
isConstructorsRequiredPropertiesOnly() |
boolean |
isFormatDates() |
boolean |
isFormatDateTimes() |
boolean |
isGenerateBuilders() |
boolean |
isIncludeAccessors() |
boolean |
isIncludeAdditionalProperties() |
boolean |
isIncludeConstructors() |
boolean |
isIncludeDynamicAccessors() |
boolean |
isIncludeHashcodeAndEquals() |
boolean |
isIncludeJsr303Annotations() |
boolean |
isIncludeJsr305Annotations() |
boolean |
isIncludeToString() |
boolean |
isInitializeCollections() |
boolean |
isParcelable() |
boolean |
isRemoveOldOutput() |
boolean |
isSerializable() |
boolean |
isSkip()
Should this task be skipped? (don't read schemas, don't generate types)
|
boolean |
isUseBigDecimals() |
boolean |
isUseBigIntegers() |
boolean |
isUseCommonsLang3() |
boolean |
isUseDoubleNumbers() |
boolean |
isUseJodaDates() |
boolean |
isUseJodaLocalDates() |
boolean |
isUseJodaLocalTimes() |
boolean |
isUseLongIntegers() |
boolean |
isUsePrimitives() |
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 |
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 |
setGenerateBuilders(boolean generateBuilders)
Sets the 'generateBuilders' property of this class.
|
void |
setIncludeAccessors(boolean includeAccessors)
Sets the 'includeAccessors' property of this class
|
void |
setIncludeAdditionalProperties(boolean includeAdditionalProperties)
Sets the 'includeAdditionalProperties' property of this class
|
void |
setIncludeConstructors(boolean includeConstructors)
Sets the 'includeConstructors' property of this class
|
void |
setIncludeDynamicAccessors(boolean includeDynamicAccessors)
Sets the 'includeDynamicAccessors' 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 |
setIncludeToString(boolean includeToString)
Sets the 'includeToString' 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 |
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 |
setUsePrimitives(boolean usePrimitives)
Sets the 'usePrimitives' property of this class.
|
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskTypepublic void execute()
throws org.apache.tools.ant.BuildException
execute in class org.apache.tools.ant.Taskorg.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)
constructorsRequiredPropertiesOnly - Whether generated constructors should have parameters for all
properties, or only required ones.public 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 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 setInclusionLevel(InclusionLevel inclusionLevel)
inclusionLevel - The level of inclusion for Jackson1 and Jackson2 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 setSourceType(SourceType sourceType)
sourceType - The type of input documents that will be read
Supported values:
jsonschemajsonpublic 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 setUseJodaDates(boolean useJodaDates)
useJodaDates - Whether to use org.joda.time.DateTime instead of
Date when adding date type fields to
generated Java types.public void setUseJodaLocalDates(boolean useJodaLocalDates)
useJodaLocalDates - Whether to use org.joda.time.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 org.joda.time.LocalTime instead of
string when adding string fields of format time (not
date-time) to generated Java types.public void setUseCommonsLang3(boolean useCommonsLang3)
useCommonsLang3 - Whether to use commons-lang 3.x imports instead of
commons-lang 2.x imports when adding equals, hashCode and
toString methods.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 setIncludeAccessors(boolean includeAccessors)
includeAccessors - Whether to include getters/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 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 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 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 boolean isGenerateBuilders()
isGenerateBuilders in interface GenerationConfigpublic boolean isUsePrimitives()
isUsePrimitives in interface GenerationConfigpublic Iterator<URL> getSource()
getSource in interface GenerationConfigpublic File getTargetDirectory()
getTargetDirectory in interface GenerationConfigpublic String getTargetPackage()
getTargetPackage in interface GenerationConfigpublic char[] getPropertyWordDelimiters()
getPropertyWordDelimiters in interface GenerationConfigpublic boolean isSkip()
true if this task is disabledpublic boolean isUseLongIntegers()
isUseLongIntegers in interface GenerationConfigpublic boolean isUseDoubleNumbers()
isUseDoubleNumbers in interface GenerationConfigpublic boolean isIncludeHashcodeAndEquals()
isIncludeHashcodeAndEquals in interface GenerationConfigpublic boolean isIncludeToString()
isIncludeToString in interface GenerationConfigpublic String[] getToStringExcludes()
getToStringExcludes in interface GenerationConfigpublic AnnotationStyle getAnnotationStyle()
getAnnotationStyle in interface GenerationConfigpublic InclusionLevel getInclusionLevel()
getInclusionLevel in interface GenerationConfigpublic Class<? extends Annotator> getCustomAnnotator()
getCustomAnnotator in interface GenerationConfigpublic Class<? extends RuleFactory> getCustomRuleFactory()
getCustomRuleFactory in interface GenerationConfigpublic boolean isIncludeJsr303Annotations()
isIncludeJsr303Annotations in interface GenerationConfigpublic boolean isIncludeJsr305Annotations()
isIncludeJsr305Annotations in interface GenerationConfigpublic SourceType getSourceType()
getSourceType in interface GenerationConfigpublic 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()
isRemoveOldOutput in interface GenerationConfigpublic String getOutputEncoding()
getOutputEncoding in interface GenerationConfigpublic boolean isUseJodaDates()
isUseJodaDates in interface GenerationConfigpublic boolean isUseJodaLocalDates()
isUseJodaLocalDates in interface GenerationConfigpublic boolean isUseJodaLocalTimes()
isUseJodaLocalTimes in interface GenerationConfigpublic boolean isUseCommonsLang3()
isUseCommonsLang3 in interface GenerationConfigpublic boolean isParcelable()
isParcelable in interface GenerationConfigpublic boolean isSerializable()
isSerializable in interface GenerationConfigpublic FileFilter getFileFilter()
getFileFilter in interface GenerationConfigpublic boolean isInitializeCollections()
isInitializeCollections in interface GenerationConfigpublic String getClassNamePrefix()
getClassNamePrefix in interface GenerationConfigpublic String getClassNameSuffix()
getClassNameSuffix in interface GenerationConfigpublic String[] getFileExtensions()
getFileExtensions in interface GenerationConfigpublic boolean isIncludeConstructors()
isIncludeConstructors in interface GenerationConfigpublic boolean isConstructorsRequiredPropertiesOnly()
isConstructorsRequiredPropertiesOnly in interface GenerationConfigpublic boolean isIncludeAdditionalProperties()
isIncludeAdditionalProperties in interface GenerationConfigpublic boolean isIncludeAccessors()
isIncludeAccessors in interface GenerationConfigpublic String getTargetVersion()
getTargetVersion in interface GenerationConfigpublic boolean isIncludeDynamicAccessors()
isIncludeDynamicAccessors in interface GenerationConfigpublic String getDateTimeType()
getDateTimeType in interface GenerationConfigpublic String getDateType()
getDateType in interface GenerationConfigpublic String getTimeType()
getTimeType in interface GenerationConfigpublic boolean isUseBigIntegers()
isUseBigIntegers in interface GenerationConfigpublic boolean isUseBigDecimals()
isUseBigDecimals in interface GenerationConfigpublic boolean isFormatDateTimes()
isFormatDateTimes in interface GenerationConfigpublic boolean isFormatDates()
isFormatDates in interface GenerationConfigpublic String getCustomDatePattern()
getCustomDatePattern in interface GenerationConfigpublic String getCustomDateTimePattern()
getCustomDateTimePattern in interface GenerationConfigpublic String getRefFragmentPathDelimiters()
getRefFragmentPathDelimiters in interface GenerationConfigpublic SourceSortOrder getSourceSortOrder()
getSourceSortOrder in interface GenerationConfigCopyright © 2017. All rights reserved.