diff --git a/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/DefaultRule.java b/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/DefaultRule.java index e1d295228..52c378ad7 100644 --- a/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/DefaultRule.java +++ b/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/DefaultRule.java @@ -16,19 +16,6 @@ package org.jsonschema2pojo.rules; -import static org.apache.commons.lang3.StringUtils.*; - -import java.text.ParseException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.joda.time.DateTime; -import org.jsonschema2pojo.Schema; - import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.util.StdDateFormat; @@ -40,10 +27,20 @@ import com.sun.codemodel.JFieldVar; import com.sun.codemodel.JInvocation; import com.sun.codemodel.JType; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import static org.apache.commons.lang3.StringUtils.*; +import org.joda.time.DateTime; +import org.jsonschema2pojo.Schema; /** * Applies the "enum" schema rule. - * + * * @see http://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.20 */ @@ -64,7 +61,7 @@ public DefaultRule(RuleFactory ruleFactory) { *
* Collections (Lists and Sets) are initialized to an empty collection, even * when no default value is present in the schema (node is null). - * + * * @param nodeName * the name of the property which has (or may have) a default * @param node @@ -84,7 +81,7 @@ public JFieldVar apply(String nodeName, JsonNode node, JFieldVar field, Schema c if (defaultPresent && !field.type().isPrimitive() && node.isNull()) { field.init(JExpr._null()); - + } else if (fieldType.startsWith(List.class.getName())) { field.init(getDefaultList(field.type(), node)); @@ -151,7 +148,7 @@ private Class> getDateType() { *