Package org.jsonschema2pojo.rules
Class SchemaRule
java.lang.Object
org.jsonschema2pojo.rules.SchemaRule
- All Implemented Interfaces:
Rule<com.sun.codemodel.JClassContainer,com.sun.codemodel.JType>
public class SchemaRule
extends Object
implements Rule<com.sun.codemodel.JClassContainer,com.sun.codemodel.JType>
Applies a JSON schema.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.sun.codemodel.JTypeapply(String nodeName, com.fasterxml.jackson.databind.JsonNode schemaNode, com.fasterxml.jackson.databind.JsonNode parent, com.sun.codemodel.JClassContainer generatableType, Schema schema) Applies this schema rule to take the required code generation steps.
-
Constructor Details
-
SchemaRule
-
-
Method Details
-
apply
public com.sun.codemodel.JType apply(String nodeName, com.fasterxml.jackson.databind.JsonNode schemaNode, com.fasterxml.jackson.databind.JsonNode parent, com.sun.codemodel.JClassContainer generatableType, Schema schema) Applies this schema rule to take the required code generation steps.At the root of a schema document this rule should be applied (schema documents contain a schema), but also in many places within the document. Each property of type "object" is itself defined by a schema, the items attribute of an array is a schema, the additionalProperties attribute of a schema is also a schema.
Where the schema value is a $ref, the ref URI is assumed to be applicable as a URL (from which content will be read). Where the ref URI has been encountered before, the root Java type created by that schema will be re-used (generation steps won't be repeated).
- Specified by:
applyin interfaceRule<com.sun.codemodel.JClassContainer,com.sun.codemodel.JType> - Parameters:
schema- the schema within which this schema rule is being appliednodeName- the name of the JSON schema nodeschemaNode- the JSON schema node that has caused this rule to be appliedparent- the JSON parent ofnodegeneratableType- A code generation construct to which this rule should be applied- Returns:
- the newly generated source code item that was added/created as a result of executing this rule
-