Modifier | Constructor and Description |
---|---|
protected |
PropertyRule(RuleFactory ruleFactory) |
Modifier and Type | Method and Description |
---|---|
com.sun.codemodel.JDefinedClass |
apply(String nodeName,
com.fasterxml.jackson.databind.JsonNode node,
com.fasterxml.jackson.databind.JsonNode parent,
com.sun.codemodel.JDefinedClass jclass,
Schema schema)
Applies this schema rule to take the required code generation steps.
|
protected PropertyRule(RuleFactory ruleFactory)
public com.sun.codemodel.JDefinedClass apply(String nodeName, com.fasterxml.jackson.databind.JsonNode node, com.fasterxml.jackson.databind.JsonNode parent, com.sun.codemodel.JDefinedClass jclass, Schema schema)
This rule adds a property to a given Java class according to the Java Bean spec. A private field is added to the class, along with accompanying accessor methods.
If this rule's schema mapper is configured to include builder methods
(see GenerationConfig.isGenerateBuilders()
),
then a builder method of the form withFoo(Foo foo);
is also
added.
apply
in interface Rule<com.sun.codemodel.JDefinedClass,com.sun.codemodel.JDefinedClass>
nodeName
- the name of the property to be appliednode
- the node describing the characteristics of this propertyparent
- the parent nodejclass
- the Java class which should have this property addedschema
- the schema to which this schema rule (and the given node)
belongs.Copyright © 2022. All rights reserved.