Constructor and Description |
---|
DefaultRule(RuleFactory ruleFactory) |
Modifier and Type | Method and Description |
---|---|
com.sun.codemodel.JFieldVar |
apply(String nodeName,
com.fasterxml.jackson.databind.JsonNode node,
com.sun.codemodel.JFieldVar field,
Schema currentSchema)
Applies this schema rule to take the required code generation steps.
|
public DefaultRule(RuleFactory ruleFactory)
public com.sun.codemodel.JFieldVar apply(String nodeName, com.fasterxml.jackson.databind.JsonNode node, com.sun.codemodel.JFieldVar field, Schema currentSchema)
Default values are implemented by assigning an expression to the given field (so when instances of the generated POJO are created, its fields will then contain their default values).
Collections (Lists and Sets) are initialized to an empty collection, even when no default value is present in the schema (node is null).
apply
in interface Rule<com.sun.codemodel.JFieldVar,com.sun.codemodel.JFieldVar>
nodeName
- the name of the property which has (or may have) a defaultnode
- the default node (may be null if no default node was present
for this property)field
- the Java field that has added to a generated type to represent
this propertycurrentSchema
- the schema to which this schema rule (and the given node)
belongs.Copyright © 2015. All rights reserved.