Modifier | Constructor and Description |
---|---|
protected |
AdditionalPropertiesRule(RuleFactory ruleFactory) |
Modifier and Type | Method and Description |
---|---|
com.sun.codemodel.JDefinedClass |
apply(String nodeName,
com.fasterxml.jackson.databind.JsonNode node,
com.sun.codemodel.JDefinedClass jclass,
Schema schema)
Applies this schema rule to take the required code generation steps.
|
protected AdditionalPropertiesRule(RuleFactory ruleFactory)
public com.sun.codemodel.JDefinedClass apply(String nodeName, com.fasterxml.jackson.databind.JsonNode node, com.sun.codemodel.JDefinedClass jclass, Schema schema)
If additionalProperties is specified and set to the boolean value
false
, this rule does not make any change to the generated
Java type (the type does not allow additional properties).
If the additionalProperties node is null
(not specified in
the schema) or empty, then a new bean property named
"additionalProperties", of type Map
<String,Object> is
added to the generated type (with appropriate accessors). The accessors
are annotated to allow unrecognised (additional) properties found in JSON
data to be marshalled/unmarshalled from/to this map.
If the additionalProperties node is present and specifies a schema, then an "additionalProperties" map is added to the generated type. This time the map values will be restricted and must be instances of a newly generated Java type that will be created based on the additionalProperties schema provided. If the schema does not specify the javaType property, the name of the newly generated type will be derived from the nodeName and the suffix 'Property'.
apply
in interface Rule<com.sun.codemodel.JDefinedClass,com.sun.codemodel.JDefinedClass>
nodeName
- the name of the schema node for which the additionalProperties
node appliesnode
- the additionalProperties node itself, found in the schema (may
be null if not specified in the schema)jclass
- the Java type that is being generated to represent this schemaschema
- the schema to which this schema rule (and the given node)
belongs.Copyright © 2015. All rights reserved.