Skip to content

Commit

Permalink
Merge pull request joelittlejohn#8 from flibbertigibbet/develop
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
flibbertigibbet authored Jun 13, 2016
2 parents 81ecfaf + eb0d272 commit fe92777
Show file tree
Hide file tree
Showing 84 changed files with 2,251 additions and 326 deletions.
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# Changelog

## 0.4.23
* Force lower camel case fields when using JSON ([#563](https://github.com/joelittlejohn/jsonschema2pojo/issues/563))
* Fix broken embedded refs ([#560](https://github.com/joelittlejohn/jsonschema2pojo/pull/560))
* Added file extensions config parameter ([#548](https://github.com/joelittlejohn/jsonschema2pojo/pull/548))
* Overridden builders are not added to empty child class ([#538](https://github.com/joelittlejohn/jsonschema2pojo/issues/538))
* Wrong default value for BigDecimal ([#535](https://github.com/joelittlejohn/jsonschema2pojo/issues/535))
* Add Moshi 1.x annotation style ([#529](https://github.com/joelittlejohn/jsonschema2pojo/pull/529))
* Zip of binary distribution of CLI ([#500](https://github.com/joelittlejohn/jsonschema2pojo/issues/500))
* Add serializable as an optional/configurable option ([#404](https://github.com/joelittlejohn/jsonschema2pojo/issues/404))

## 0.4.22
* Adding date-time types to Maven plugin mojo configuration ([#531](https://github.com/joelittlejohn/jsonschema2pojo/pull/531))
* Fix javaName breaking required properties ([#528](https://github.com/joelittlejohn/jsonschema2pojo/pull/528))
* Add support for using BigDecimal to represent numbers ([#517](https://github.com/joelittlejohn/jsonschema2pojo/pull/517))
* Jsonschema2pojoRule report problems to STDERR ([#513](https://github.com/joelittlejohn/jsonschema2pojo/pull/513))

## 0.4.21
* Fix NullPointerException in Gradle plugin for Java (non-Android) projects ([#510](https://github.com/joelittlejohn/jsonschema2pojo/pull/510))

## 0.4.20
* Regression: when a extending a schema with a redefinition of the same field, with methods should be generated only once ([#507](https://github.com/joelittlejohn/jsonschema2pojo/issues/507))
* Unnecessary @SuppressWarnings java warnings after upgrade ([#498](https://github.com/joelittlejohn/jsonschema2pojo/issues/498))
* Improved Android support via Gradle plugin (NOTE: Changes behaviour regarding output directory) ([#495](https://github.com/joelittlejohn/jsonschema2pojo/pull/495))

## 0.4.19
* Add javaName schema property ([#499](https://github.com/joelittlejohn/jsonschema2pojo/pull/499))
* Declare an enum without that "static" ([#496](https://github.com/joelittlejohn/jsonschema2pojo/issues/496))
Expand Down
7 changes: 7 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@
* P Wilder
* Rakshith Rao (rakrao)
* Lomig Megard
* Rami Baksansky
* Dimitrij Drus
* Arno Puder
* SpaceBison
* Mike Woudenberg
* Tobias Preuss
* Max Myslyvtsev
* Thach Hoang
* Sam Duke
* Alex Macrae
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# jsonschema2pojo [![Build Status](https://travis-ci.org/joelittlejohn/jsonschema2pojo.png)](https://travis-ci.org/joelittlejohn/jsonschema2pojo) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.jsonschema2pojo/jsonschema2pojo/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.jsonschema2pojo/jsonschema2pojo)
# jsonschema2pojo [![Build Status](https://travis-ci.org/joelittlejohn/jsonschema2pojo.svg?branch=master)](https://travis-ci.org/joelittlejohn/jsonschema2pojo) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.jsonschema2pojo/jsonschema2pojo/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.jsonschema2pojo/jsonschema2pojo)

_jsonschema2pojo_ generates Java types from JSON Schema (or example JSON) and can annotate those types for data-binding with Jackson 1.x, Jackson 2.x or Gson.

Expand All @@ -11,7 +11,7 @@ A very simple Maven example:
<plugin>
<groupId>org.jsonschema2pojo</groupId>
<artifactId>jsonschema2pojo-maven-plugin</artifactId>
<version>0.4.19</version>
<version>0.4.23</version>
<configuration>
<sourceDirectory>${basedir}/src/main/resources/schema</sourceDirectory>
<targetPackage>com.example.types</targetPackage>
Expand All @@ -30,9 +30,9 @@ Useful pages:
* **[Getting started](https://github.com/joelittlejohn/jsonschema2pojo/wiki/Getting-Started)**
* **[How to contribute](https://github.com/joelittlejohn/jsonschema2pojo/wiki/Contribute)**
* [Reference](https://github.com/joelittlejohn/jsonschema2pojo/wiki/Reference)
* [Latest Javadocs](http://joelittlejohn.github.io/jsonschema2pojo/javadocs/0.4.19/)
* [Documentation for the Maven plugin](http://joelittlejohn.github.io/jsonschema2pojo/site/0.4.19/generate-mojo.html)
* [Documentation for the Ant task](http://joelittlejohn.github.io/jsonschema2pojo/site/0.4.19/Jsonschema2PojoTask.html)
* [Latest Javadocs](https://joelittlejohn.github.io/jsonschema2pojo/javadocs/0.4.23/)
* [Documentation for the Maven plugin](https://joelittlejohn.github.io/jsonschema2pojo/site/0.4.23/generate-mojo.html)
* [Documentation for the Ant task](https://joelittlejohn.github.io/jsonschema2pojo/site/0.4.23/Jsonschema2PojoTask.html)

Project resources:
* [Downloads](https://github.com/joelittlejohn/jsonschema2pojo/releases)
Expand Down
2 changes: 1 addition & 1 deletion jsonschema2pojo-ant/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>jsonschema2pojo</artifactId>
<groupId>org.jsonschema2pojo</groupId>
<version>0.4.20-SNAPSHOT</version>
<version>0.4.24-SNAPSHOT</version>
</parent>

<artifactId>jsonschema2pojo-ant</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ public class Jsonschema2PojoTask extends Task implements GenerationConfig {

private boolean useDoubleNumbers = true;

private boolean useBigDecimals = false;

private boolean includeHashcodeAndEquals = true;

private boolean includeToString = true;
Expand Down Expand Up @@ -109,18 +111,22 @@ public class Jsonschema2PojoTask extends Task implements GenerationConfig {

private boolean parcelable = false;

private boolean serializable = false;

private boolean initializeCollections = true;

private String classNamePrefix = "";

private String classNameSuffix = "";

private String[] fileExtensions = new String[] {};

private boolean constructorsRequiredPropertiesOnly = false;

private boolean includeAdditionalProperties = true;

private boolean includeAccessors = true;

private String targetVersion = "1.6";

private boolean includeDynamicAccessors = false;
Expand Down Expand Up @@ -290,6 +296,19 @@ public void setUseDoubleNumbers(boolean useDoubleNumbers) {
this.useDoubleNumbers = useDoubleNumbers;
}

/**
* Sets the 'useBigDecimals' property of this class
*
* @param useBigDecimals
* Whether to use the java type <code>BigDecimal</code>
* instead of <code>float</code> (or {@link java.lang.Float})
* when representing the JSON Schema type 'number'. Note that
* this overrides <code>useDoubleNumbers</code>.
*/
public void setUseBigDecimals(boolean useBigDecimals) {
this.useBigDecimals = useBigDecimals;
}

/**
* Sets schema file (or directory containing schema files) that should be
* used for input.
Expand Down Expand Up @@ -524,6 +543,16 @@ public void setParcelable(boolean parcelable) {
this.parcelable = parcelable;
}

/**
* Sets the 'serializable' property of this class
*
* @param serializable
* Whether to make the generated types 'serializable'.
*/
public void setSerializable(boolean serializable) {
this.serializable = serializable;
}

/**
* Sets the 'initializeCollections' property of this class
*
Expand All @@ -534,6 +563,37 @@ public void setInitializeCollections(boolean initializeCollections) {
this.initializeCollections = initializeCollections;
}

/**
* Sets the 'classNamePrefix' property of this class
*
* @param classNamePrefix
* Whether to add a prefix to generated classes.
*/
public void setClassNamePrefix(String classNamePrefix) {
this.classNamePrefix = classNamePrefix;
}

/**
* Sets the 'classNameSuffix' property of this class
*
* @param classNameSuffix
* Whether to add a suffix to generated classes.
*/
public void setClassNameSuffix(String classNameSuffix) {
this.classNameSuffix = classNameSuffix;
}

/**
* Sets the 'fileExtensions' property of this class
*
* @param classNameSuffix
* The array of strings that should be considered as file
* extensions and therefore not included in class names.
*/
public void setFileExtensions(String[] fileExtensions) {
this.fileExtensions = fileExtensions;
}

/**
* Sets the 'includeAdditionalProperties' property of this class
*
Expand Down Expand Up @@ -721,6 +781,11 @@ public boolean isParcelable() {
return parcelable;
}

@Override
public boolean isSerializable() {
return serializable;
}

@Override
public FileFilter getFileFilter() {
return new AllFileFilter();
Expand All @@ -741,6 +806,11 @@ public String getClassNameSuffix() {
return classNameSuffix;
}

@Override
public String[] getFileExtensions() {
return fileExtensions;
}

@Override
public boolean isIncludeConstructors() {
return includeConstructors;
Expand Down Expand Up @@ -785,4 +855,9 @@ public String getDateType() {
public String getTimeType() {
return timeType;
}

@Override
public boolean isUseBigDecimals() {
return useBigDecimals;
}
}
18 changes: 17 additions & 1 deletion jsonschema2pojo-ant/src/site/Jsonschema2PojoTask.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ <h3>Parameters</h3>
<li><code>JACKSON2</code> (apply annotations from the <a href="https://github.com/FasterXML/jackson-annotations">Jackson 2.x</a> library)</li>
<li><code>JACKSON1</code> (apply annotations from the <a href="http://jackson.codehaus.org/">Jackson 1.x</a> library)</li>
<li><code>GSON</code> (apply annotations from the <a href="https://code.google.com/p/google-gson//">Gson</a> library)</li>
<li><code>MOSHI1</code> (apply annotations from the <a href="https://github.com/square/moshi//">Moshi 1.x</a> library)</li>
<li><code>NONE</code> (apply no annotations at all)</li>
</ul>
</td>
Expand All @@ -50,9 +51,14 @@ <h3>Parameters</h3>
</tr>
<tr>
<td valign="top">classNameSuffix</td>
<td valign="top">Whether to add a Suffix to generated classes</td>
<td valign="top">Whether to add a suffix to generated classes</td>
<td align="center" valign="top">No (default <code>""</code>)</td>
</tr>
<tr>
<td valign="top">fileExtensions</td>
<td valign="top">A string containing file extensions that should be considered full extensions and therefore ignored when generating classnames.</td>
<td align="center" valign="top">No (default <code>""</code> (none))</td>
</tr>
<tr>
<td valign="top">classpath</td>
<td valign="top">Additional classpath to use. Any path elements provided here will be added to the classpath when this task is invoked.
Expand Down Expand Up @@ -163,6 +169,11 @@ <h3>Parameters</h3>
<td valign="top">**EXPERIMENTAL** Whether to make the generated types 'parcelable' (for Android development).</td>
<td align="center" valign="top">No (default <code>false</code>)</td>
</tr>
<tr>
<td valign="top">serializable</td>
<td valign="top">Whether to make the generated types 'serializable'.</td>
<td align="center" valign="top">No (default <code>false</code>)</td>
</tr>
<tr>
<td valign="top">propertyWordDelimiters</td>
<td valign="top">A string containing any characters that should act as word delimiters when choosing Java bean property names.</td>
Expand Down Expand Up @@ -208,6 +219,11 @@ <h3>Parameters</h3>
<td valign="top">Whether to use the java type <code>double</code> (or <code>Double</code>) instead of <code>float</code> (or <code>Float</code>) when representing the JSON Schema type 'number'.</td>
<td align="center" valign="top">No (default <code>true</code>)</td>
</tr>
<tr>
<td valign="top">useBigDecimals</td>
<td valign="top">Whether to use the java type <code>BigDecimal</code> instead of <code>float</code> (or <code>java.lang.Float</code>) when representing the JSON Schema type 'number'. Note that this overrides <code>useDoubleNumbers</code>.</td>
<td align="center" valign="top">No (default <code>false</code>)</td>
</tr>
<tr>
<td valign="top">useJodaDates</td>
<td valign="top">Whether to use <code>org.joda.time.DateTime</code> instead of <code>java.util.Date</code> when adding date-time type fields to generated Java types.</td>
Expand Down
2 changes: 1 addition & 1 deletion jsonschema2pojo-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>jsonschema2pojo</artifactId>
<groupId>org.jsonschema2pojo</groupId>
<version>0.4.20-SNAPSHOT</version>
<version>0.4.24-SNAPSHOT</version>
</parent>

<artifactId>jsonschema2pojo-cli</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ public class Arguments implements GenerationConfig {
@Parameter(names = { "-f", "--float-numbers" }, description = "Use float (or Float) instead of double (or Double) when the JSON Schema type 'number' is encountered")
private boolean useFloatNumbers = false;

@Parameter(names = { "-i", "--big-decimals" }, description = "Use BigDecimal instead of double (or Double) when the JSON Schema type 'number' is encountered. Note that this overrides useFloatNumbers/-f/--float-numbers")
private boolean useBigDecimals = false;

@Parameter(names = { "-E", "--omit-hashcode-and-equals" }, description = "Omit hashCode and equals methods in the generated Java types")
private boolean omitHashcodeAndEquals = false;

Expand Down Expand Up @@ -126,6 +129,9 @@ public class Arguments implements GenerationConfig {
@Parameter(names = { "-pl", "--parcelable" }, description = "**EXPERIMENTAL** Whether to make the generated types 'parcelable' (for Android development).")
private boolean parcelable = false;

@Parameter(names = { "-sl", "--serializable" }, description = "Whether to make the generated types 'serializable'.")
private boolean serializable = false;

@Parameter(names = { "-N", "--null-collections" }, description = "Initialize Set and List fields to null instead of an empty collection.")
private boolean nullCollections = false;

Expand All @@ -135,15 +141,18 @@ public class Arguments implements GenerationConfig {
@Parameter(names = { "-x", "--class-suffix" }, description = "Suffix for generated class.")
private String classNameSuffix = "";

@Parameter(names = { "-fe", "--file-extensions" }, description = "The extensions that should be considered as standard filename extensions when creating java class names.")
private String fileExtensions = "";

@Parameter(names = { "-D", "--disable-additional-properties" }, description = "Disable additional properties support on generated types, regardless of the input schema(s)")
private boolean disableAdditionalProperties = false;

@Parameter(names = { "-da", "--disable-accessors" }, description = "Whether to omit getter/setter methods and create public fields instead.")
private boolean disableAccessors = false;

@Parameter(names = { "-tv", "--target-version" }, description = "The target version for generated source files.")
private String targetVersion = "1.6";

@Parameter(names = { "-ida", "--include-dynamic-accessors" }, description = "Include dynamic getter, setter, and builder support on generated types.")
private boolean includeDynamicAccessors = false;

Expand Down Expand Up @@ -292,6 +301,11 @@ public boolean isParcelable() {
return parcelable;
}

@Override
public boolean isSerializable() {
return serializable;
}

protected void exit(int status) {
System.exit(status);
}
Expand All @@ -316,6 +330,11 @@ public String getClassNameSuffix() {
return classNameSuffix;
}

@Override
public String[] getFileExtensions() {
return defaultString(fileExtensions).split(" ");
}

@Override
public boolean isIncludeConstructors() {
return generateConstructors;
Expand Down Expand Up @@ -361,4 +380,7 @@ public String getTimeType() {
return timeType;
}

public boolean isUseBigDecimals() {
return useBigDecimals;
}
}
6 changes: 5 additions & 1 deletion jsonschema2pojo-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>jsonschema2pojo</artifactId>
<groupId>org.jsonschema2pojo</groupId>
<version>0.4.20-SNAPSHOT</version>
<version>0.4.24-SNAPSHOT</version>
</parent>

<artifactId>jsonschema2pojo-core</artifactId>
Expand Down Expand Up @@ -33,6 +33,10 @@
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>com.squareup.moshi</groupId>
<artifactId>moshi</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import com.sun.codemodel.JMethod;

/**
* A default implemenation of the Annotator interface that makes it easier to
* plug in different Annotator implemenations.
* A default implementation of the Annotator interface that makes it easier to
* plug in different Annotator implementations.
*/
public abstract class AbstractAnnotator implements Annotator {

Expand Down
Loading

0 comments on commit fe92777

Please sign in to comment.