public class Jsonschema2PojoTask
extends org.apache.tools.ant.Task
implements org.jsonschema2pojo.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).
|
org.jsonschema2pojo.AnnotationStyle |
getAnnotationStyle() |
org.apache.tools.ant.types.Path |
getClasspath() |
Class<? extends org.jsonschema2pojo.Annotator> |
getCustomAnnotator() |
String |
getOutputEncoding() |
char[] |
getPropertyWordDelimiters() |
Iterator<File> |
getSource() |
org.jsonschema2pojo.SourceType |
getSourceType() |
File |
getTargetDirectory() |
String |
getTargetPackage() |
boolean |
isGenerateBuilders() |
boolean |
isIncludeHashcodeAndEquals() |
boolean |
isIncludeJsr303Annotations() |
boolean |
isIncludeToString() |
boolean |
isRemoveOldOutput() |
boolean |
isSkip()
Should this task be skipped? (don't read schemas, don't generate types)
|
boolean |
isUseDoubleNumbers() |
boolean |
isUseJodaDates() |
boolean |
isUseLongIntegers() |
boolean |
isUsePrimitives() |
void |
setAnnotationStyle(org.jsonschema2pojo.AnnotationStyle annotationStyle)
Sets the 'annotationStyle' property of this class
|
void |
setClasspath(org.apache.tools.ant.types.Path classpath) |
void |
setClasspathRef(org.apache.tools.ant.types.Reference classpathRef) |
void |
setCustomAnnotator(String customAnnotator)
Sets the 'customAnnotator' property of this class
|
void |
setGenerateBuilders(boolean generateBuilders)
Sets the 'generateBuilders' 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 |
setIncludeToString(boolean includeToString)
Sets the 'includeToString' property of this class
|
void |
setOutputEncoding(String outputEncoding)
Sets the 'outputEncoding' property of this class
|
void |
setPropertyWordDelimiters(String propertyWordDelimiters) |
void |
setRemoveOldOutput(boolean removeOldOutput)
Sets the 'removeOldOutput' property of this class
|
void |
setSkip(boolean skip)
Sets the 'skip' property of this task.
|
void |
setSource(File source)
Sets schema file (or directory containing schema files) that should be
used for input.
|
void |
setSourceType(org.jsonschema2pojo.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 |
setUseDoubleNumbers(boolean useDoubleNumbers)
Sets the 'useDoubleNumbers' property of this class
|
void |
setUseJodaDates(boolean useJodaDates)
Sets the 'useJodaDates' 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 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 setUseDoubleNumbers(boolean useDoubleNumbers)
public void setSource(File 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(org.jsonschema2pojo.AnnotationStyle annotationStyle)
annotationStyle - The style of annotations to use in the generated Java types.public void setCustomAnnotator(String customAnnotator)
customAnnotator - A custom annotator to use to annotate the generated typespublic void setIncludeJsr303Annotations(boolean includeJsr303Annotations)
includeJsr303Annotations - Whether to include JSR-303
annotations (for schema rules like minimum, maximum, etc) in
generated Java types.public void setSourceType(org.jsonschema2pojo.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 boolean isGenerateBuilders()
isGenerateBuilders in interface org.jsonschema2pojo.GenerationConfigpublic boolean isUsePrimitives()
isUsePrimitives in interface org.jsonschema2pojo.GenerationConfigpublic Iterator<File> getSource()
getSource in interface org.jsonschema2pojo.GenerationConfigpublic File getTargetDirectory()
getTargetDirectory in interface org.jsonschema2pojo.GenerationConfigpublic String getTargetPackage()
getTargetPackage in interface org.jsonschema2pojo.GenerationConfigpublic char[] getPropertyWordDelimiters()
getPropertyWordDelimiters in interface org.jsonschema2pojo.GenerationConfigpublic boolean isSkip()
true if this task is disabledpublic boolean isUseLongIntegers()
isUseLongIntegers in interface org.jsonschema2pojo.GenerationConfigpublic boolean isUseDoubleNumbers()
isUseDoubleNumbers in interface org.jsonschema2pojo.GenerationConfigpublic boolean isIncludeHashcodeAndEquals()
isIncludeHashcodeAndEquals in interface org.jsonschema2pojo.GenerationConfigpublic boolean isIncludeToString()
isIncludeToString in interface org.jsonschema2pojo.GenerationConfigpublic org.jsonschema2pojo.AnnotationStyle getAnnotationStyle()
getAnnotationStyle in interface org.jsonschema2pojo.GenerationConfigpublic Class<? extends org.jsonschema2pojo.Annotator> getCustomAnnotator()
getCustomAnnotator in interface org.jsonschema2pojo.GenerationConfigpublic boolean isIncludeJsr303Annotations()
isIncludeJsr303Annotations in interface org.jsonschema2pojo.GenerationConfigpublic org.jsonschema2pojo.SourceType getSourceType()
getSourceType in interface org.jsonschema2pojo.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 org.jsonschema2pojo.GenerationConfigpublic String getOutputEncoding()
getOutputEncoding in interface org.jsonschema2pojo.GenerationConfigpublic boolean isUseJodaDates()
isUseJodaDates in interface org.jsonschema2pojo.GenerationConfigCopyright © 2013. All Rights Reserved.