Modifier | Constructor and Description |
---|---|
protected |
ArrayRule(RuleFactory ruleFactory) |
Modifier and Type | Method and Description |
---|---|
com.sun.codemodel.JClass |
apply(String nodeName,
com.fasterxml.jackson.databind.JsonNode node,
com.sun.codemodel.JPackage jpackage,
Schema schema)
Applies this schema rule to take the required code generation steps.
|
protected ArrayRule(RuleFactory ruleFactory)
public com.sun.codemodel.JClass apply(String nodeName, com.fasterxml.jackson.databind.JsonNode node, com.sun.codemodel.JPackage jpackage, Schema schema)
Applies this schema rule to take the required code generation steps.
When constructs of type "array" appear in the schema, these are mapped to
Java collections in the generated POJO. If the array is marked as having
"uniqueItems" then the resulting Java type is Set
, if not, then
the resulting Java type is List
. The schema given by "items" will
decide the generic type of the collection.
If the "items" property requires newly generated types, then the type name will be the singular version of the nodeName (unless overridden by the javaType property) e.g.
"fooBars" : {"type":"array", "uniqueItems":"true", "items":{type:"object"}}
==>
Set<FooBar> getFooBars();
apply
in interface Rule<com.sun.codemodel.JPackage,com.sun.codemodel.JClass>
nodeName
- the name of the property which has type "array"node
- the schema "type" nodejpackage
- the package into which newly generated types should be addedschema
- the schema to which this schema rule (and the given node)
belongs.Set
or List
, narrowed by the "items" typeCopyright © 2015. All rights reserved.