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
,anyOf
schemas.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CombinedSchema.Builder
Builder class forCombinedSchema
.static interface
CombinedSchema.ValidationCriterion
Validation criterion.
-
Field Summary
Fields Modifier and Type Field Description static CombinedSchema.ValidationCriterion
ALL_CRITERION
Validation criterion forallOf
schemas.static CombinedSchema.ValidationCriterion
ANY_CRITERION
Validation criterion foranyOf
schemas.static CombinedSchema.ValidationCriterion
ONE_CRITERION
Validation criterion foroneOf
schemas.-
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.Builder
allOf(Collection<Schema> schemas)
static CombinedSchema.Builder
anyOf(Collection<Schema> schemas)
static CombinedSchema.Builder
builder()
static CombinedSchema.Builder
builder(Collection<Schema> subschemas)
protected boolean
canEqual(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.boolean
definesProperty(String field)
Determines if thisSchema
instance defines any restrictions for the object property denoted byfield
.boolean
equals(Object o)
CombinedSchema.ValidationCriterion
getCriterion()
Collection<Schema>
getSubschemas()
int
hashCode()
static CombinedSchema.Builder
oneOf(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 forallOf
schemas.
-
ANY_CRITERION
public static final CombinedSchema.ValidationCriterion ANY_CRITERION
Validation criterion foranyOf
schemas.
-
ONE_CRITERION
public static final CombinedSchema.ValidationCriterion ONE_CRITERION
Validation criterion foroneOf
schemas.
-
-
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:Schema
Determines if thisSchema
instance defines any restrictions for the object property denoted byfield
. Thefield
should be a JSON pointer, denoting the property to be queried.For example the field
"#/rectangle/a"
is defined by the following schema: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:
definesProperty
in classSchema
- Parameters:
field
- should be a JSON pointer in its string representation.- Returns:
true
if the propertty denoted byfield
is defined by this schema instance
-
-