Package org.everit.json.schema
Class CombinedSchema
- java.lang.Object
-
- org.everit.json.schema.Schema
-
- org.everit.json.schema.CombinedSchema
-
public class CombinedSchema extends Schema
Validator forallOf,oneOf,anyOfschemas.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCombinedSchema.BuilderBuilder class forCombinedSchema.static interfaceCombinedSchema.ValidationCriterionValidation criterion.
-
Field Summary
Fields Modifier and Type Field Description static CombinedSchema.ValidationCriterionALL_CRITERIONValidation criterion forallOfschemas.static CombinedSchema.ValidationCriterionANY_CRITERIONValidation criterion foranyOfschemas.static CombinedSchema.ValidationCriterionONE_CRITERIONValidation criterion foroneOfschemas.-
Fields inherited from class org.everit.json.schema.Schema
schemaLocation
-
-
Constructor Summary
Constructors Constructor Description CombinedSchema(CombinedSchema.Builder builder)Constructor.
-
Method Summary
Modifier and Type Method Description static CombinedSchema.BuilderallOf(Collection<Schema> schemas)static CombinedSchema.BuilderanyOf(Collection<Schema> schemas)static CombinedSchema.Builderbuilder()static CombinedSchema.Builderbuilder(Collection<Schema> subschemas)protected booleancanEqual(Object other)Since we add state in subclasses, but want those subclasses to be non final, this allows us to have equals methods that satisfy the equals contract.booleandefinesProperty(String field)Determines if thisSchemainstance defines any restrictions for the object property denoted byfield.booleanequals(Object o)CombinedSchema.ValidationCriteriongetCriterion()Collection<Schema>getSubschemas()inthashCode()static CombinedSchema.BuilderoneOf(Collection<Schema> schemas)-
Methods inherited from class org.everit.json.schema.Schema
describeTo, failure, failure, getDefaultValue, getDescription, getId, getLocation, getSchemaLocation, getTitle, getUnprocessedProperties, hasDefaultValue, isNullable, isReadOnly, isWriteOnly, toString, validate
-
-
-
-
Field Detail
-
ALL_CRITERION
public static final CombinedSchema.ValidationCriterion ALL_CRITERION
Validation criterion forallOfschemas.
-
ANY_CRITERION
public static final CombinedSchema.ValidationCriterion ANY_CRITERION
Validation criterion foranyOfschemas.
-
ONE_CRITERION
public static final CombinedSchema.ValidationCriterion ONE_CRITERION
Validation criterion foroneOfschemas.
-
-
Constructor Detail
-
CombinedSchema
public CombinedSchema(CombinedSchema.Builder builder)
Constructor.- Parameters:
builder- the builder containing the validation criterion and the subschemas to be checked
-
-
Method Detail
-
allOf
public static CombinedSchema.Builder allOf(Collection<Schema> schemas)
-
anyOf
public static CombinedSchema.Builder anyOf(Collection<Schema> schemas)
-
builder
public static CombinedSchema.Builder builder()
-
builder
public static CombinedSchema.Builder builder(Collection<Schema> subschemas)
-
oneOf
public static CombinedSchema.Builder oneOf(Collection<Schema> schemas)
-
getCriterion
public CombinedSchema.ValidationCriterion getCriterion()
-
getSubschemas
public Collection<Schema> getSubschemas()
-
definesProperty
public boolean definesProperty(String field)
Description copied from class:SchemaDetermines if thisSchemainstance defines any restrictions for the object property denoted byfield. Thefieldshould be a JSON pointer, denoting the property to be queried.For example the field
"#/rectangle/a"is defined by the following schema:
The default implementation of this method always returns false.objectWithSchemaRectangleDep" : { "type" : "object", "dependencies" : { "d" : { "type" : "object", "properties" : { "rectangle" : {"$ref" : "#/definitions/Rectangle" } } } }, "definitions" : { "size" : { "type" : "number", "minimum" : 0 }, "Rectangle" : { "type" : "object", "properties" : { "a" : {"$ref" : "#/definitions/size"}, "b" : {"$ref" : "#/definitions/size"} } } } }- Overrides:
definesPropertyin classSchema- Parameters:
field- should be a JSON pointer in its string representation.- Returns:
trueif the propertty denoted byfieldis defined by this schema instance
-
-