Skip to content

Commit

Permalink
Merge pull request #482 from ctrimble/feature_dynamic-accessors-defau…
Browse files Browse the repository at this point in the history
…lt-off

includeDynamicAccessors default false
  • Loading branch information
joelittlejohn committed Jan 8, 2016
2 parents b629c61 + f0eec85 commit ff0ad46
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public class Jsonschema2PojoTask extends Task implements GenerationConfig {

private String targetVersion = "1.6";

private boolean includeDynamicAccessors = true;
private boolean includeDynamicAccessors = false;

private String dateTimeType = null;

Expand Down
2 changes: 1 addition & 1 deletion jsonschema2pojo-ant/src/site/Jsonschema2PojoTask.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ <h3>Parameters</h3>
<tr>
<td valign="top">includeDynamicAccessors</td>
<td valign="top">Whether to include dynamic getters, setters, and builders or to omit these methods.</td>
<td align="center" valign="top">No (default <code>true</code>)</td>
<td align="center" valign="top">No (default <code>false</code>)</td>
</tr>
<tr>
<td valign="top">includeConstructors</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public class JsonSchemaExtension implements GenerationConfig {
includeAdditionalProperties = true
includeAccessors = true
targetVersion = '1.6'
includeDynamicAccessors = true
includeDynamicAccessors = false
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void shouldSetStringField() throws Throwable {
@Test
public void shouldSetStringFieldJava7() throws Throwable {
setDeclaredPropertyTest(
config("targetVersion", "1.7"),
config("includeDynamicAccessors", true, "targetVersion", "1.7"),
"/schema/dynamic/parentType.json",
"ParentType",
String.class,
Expand Down Expand Up @@ -172,7 +172,7 @@ public void shouldBuildStringField() throws Throwable {

@Test
public void shouldSetAdditionalProperty() throws Exception {
ClassLoader resultsClassLoader = schemaRule.generateAndCompile("/schema/dynamic/parentType.json", "com.example");
ClassLoader resultsClassLoader = schemaRule.generateAndCompile("/schema/dynamic/parentType.json", "com.example", config("includeDynamicAccessors", true));

Class<?> parentType = resultsClassLoader.loadClass("com.example.ParentType");
Object instance = parentType.newInstance();
Expand All @@ -192,7 +192,7 @@ public void shouldSetAdditionalProperty() throws Exception {

@Test
public void shouldGetAdditionalProperty() throws Exception {
ClassLoader resultsClassLoader = schemaRule.generateAndCompile("/schema/dynamic/parentType.json", "com.example");
ClassLoader resultsClassLoader = schemaRule.generateAndCompile("/schema/dynamic/parentType.json", "com.example", config("includeDynamicAccessors", true));

Class<?> parentType = resultsClassLoader.loadClass("com.example.ParentType");
Object instance = parentType.newInstance();
Expand All @@ -213,7 +213,7 @@ public void shouldGetAdditionalProperty() throws Exception {
}

public void setDeclaredPropertyTest(String schemaLocation, String typeName, Class<?> fieldType, String fieldName, String fieldGetter, Object value) throws Throwable {
setDeclaredPropertyTest(config(), schemaLocation, typeName, fieldType, fieldName, fieldGetter, value);
setDeclaredPropertyTest(config("includeDynamicAccessors", true), schemaLocation, typeName, fieldType, fieldName, fieldGetter, value);
}

public void setDeclaredPropertyTest(Map<String, Object> config, String schemaLocation, String typeName, Class<?> fieldType, String fieldName, String fieldGetter, Object value) throws Throwable {
Expand All @@ -238,7 +238,7 @@ public void setDeclaredPropertyTest(Map<String, Object> config, String schemaLoc

public void withDeclaredPropertyTest(String schemaLocation, String typeName, Class<?> fieldType, String fieldName, String fieldGetter, Object value) throws Throwable {
ClassLoader resultsClassLoader =
schemaRule.generateAndCompile(schemaLocation, "com.example", config("generateBuilders", true));
schemaRule.generateAndCompile(schemaLocation, "com.example", config("includeDynamicAccessors", true, "generateBuilders", true));

Class<?> type = resultsClassLoader.loadClass("com.example." + typeName);
Object instance = type.newInstance();
Expand All @@ -260,7 +260,7 @@ public void withDeclaredPropertyTest(String schemaLocation, String typeName, Cla
}

public void getDeclaredPropertyTest(String schemaLocation, String typeName, Class<?> fieldType, String fieldName, String fieldSetter, Object value) throws Throwable {
ClassLoader resultsClassLoader = schemaRule.generateAndCompile(schemaLocation, "com.example");
ClassLoader resultsClassLoader = schemaRule.generateAndCompile(schemaLocation, "com.example", config("includeDynamicAccessors", true));

Class<?> parentType = resultsClassLoader.loadClass("com.example." + typeName);
Object instance = parentType.newInstance();
Expand All @@ -279,7 +279,7 @@ public void getDeclaredPropertyTest(String schemaLocation, String typeName, Clas
}

public void setAdditionalPropertyTest(String schemaLocation, String typeName, Class<?> fieldType, String fieldName, Object value) throws Throwable {
ClassLoader resultsClassLoader = schemaRule.generateAndCompile(schemaLocation, "com.example");
ClassLoader resultsClassLoader = schemaRule.generateAndCompile(schemaLocation, "com.example", config("includeDynamicAccessors", true));

Class<?> parentType = resultsClassLoader.loadClass("com.example." + typeName);
Object instance = parentType.newInstance();
Expand All @@ -302,7 +302,7 @@ public void setAdditionalPropertyTest(String schemaLocation, String typeName, Cl
}

public void setPropertyTest(String schemaLocation, String typeName, String fieldName, Object value) throws Throwable {
ClassLoader resultsClassLoader = schemaRule.generateAndCompile(schemaLocation, "com.example");
ClassLoader resultsClassLoader = schemaRule.generateAndCompile(schemaLocation, "com.example", config("includeDynamicAccessors", true));

Class<?> type = resultsClassLoader.loadClass("com.example." + typeName);
Object instance = type.newInstance();
Expand All @@ -316,7 +316,7 @@ public void setPropertyTest(String schemaLocation, String typeName, String field
}

public void getPropertyTest(String schemaLocation, String typeName, String fieldName) throws Throwable {
ClassLoader resultsClassLoader = schemaRule.generateAndCompile(schemaLocation, "com.example");
ClassLoader resultsClassLoader = schemaRule.generateAndCompile(schemaLocation, "com.example", config("includeDynamicAccessors", true));

Class<?> type = resultsClassLoader.loadClass("com.example." + typeName);
Object instance = type.newInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -452,10 +452,10 @@ public class Jsonschema2PojoMojo extends AbstractMojo implements GenerationConfi
* Whether to include dynamic getters, setters, and builders or to omit these methods.
*
* @parameter expression="${jsonschema2pojo.includeDynamicAccessors}"
* default-value="true"
* default-value="false"
* @since 0.4.17
*/
private boolean includeDynamicAccessors = true;
private boolean includeDynamicAccessors = false;

/**
* The project being built.
Expand Down

0 comments on commit ff0ad46

Please sign in to comment.