public class ArraySchema extends Schema
| Modifier and Type | Class and Description |
|---|---|
static class |
ArraySchema.Builder
Builder class for
ArraySchema. |
schemaLocation| Constructor and Description |
|---|
ArraySchema(ArraySchema.Builder builder)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static ArraySchema.Builder |
builder() |
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 this
Schema instance defines any restrictions for the object property
denoted by field. |
boolean |
equals(Object o) |
Schema |
getAllItemSchema() |
Schema |
getContainedItemSchema() |
List<Schema> |
getItemSchemas() |
Integer |
getMaxItems() |
Integer |
getMinItems() |
Schema |
getSchemaOfAdditionalItems() |
int |
hashCode() |
boolean |
needsUniqueItems() |
boolean |
permitsAdditionalItems() |
boolean |
requiresArray() |
describeTo, failure, failure, getDefaultValue, getDescription, getId, getLocation, getSchemaLocation, getTitle, getUnprocessedProperties, hasDefaultValue, isNullable, isReadOnly, isWriteOnly, toString, validatepublic ArraySchema(ArraySchema.Builder builder)
builder - contains validation criteria.public static ArraySchema.Builder builder()
public Schema getAllItemSchema()
public Integer getMaxItems()
public Integer getMinItems()
public Schema getSchemaOfAdditionalItems()
public Schema getContainedItemSchema()
public boolean needsUniqueItems()
public boolean permitsAdditionalItems()
public boolean requiresArray()
public boolean definesProperty(String field)
SchemaSchema instance defines any restrictions for the object property
denoted by field. The field 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"
},
"list": {
"type": "array",
"items": {
"properties": {
"prop": {}
}
},
"minItems": 2,
"maxItems: 3
}
}
}
},
"definitions" : {
"size" : {
"type" : "number",
"minimum" : 0
},
"Rectangle" : {
"type" : "object",
"properties" : {
"a" : {"$ref" : "#/definitions/size"},
"b" : {"$ref" : "#/definitions/size"}
}
}
}
}
You can also check if a subschema of an array defines a property. In that case, to traverse the array, you can either use
an integer array index, or the "all" or "any" meta-indexes. For example, in the above schema
definesProperty("#/list/any/prop") returns truedefinesProperty("#/list/all/prop") returns truedefinesProperty("#/list/1/prop") returns truedefinesProperty("#/list/1/nonexistent") returns false (the property is not present in the
subschema)definesProperty("#/list/8/prop") returns false (the "list" does not define
property 8, since "maxItems" is 3)definesProperty in class Schemafield - should be a JSON pointer in its string representation.true if the propertty denoted by field is defined by this schema
instanceprotected boolean canEqual(Object other)
Schemahttp://www.artima.com/lejava/articles/equality.html
Copyright © 2023 Everit Kft.. All rights reserved.