@Bean(typeName="schema", properties="id,$schema,$ref, title,description,type,definitions,properties,patternProperties,dependencies,items,multipleOf,maximum,exclusiveMaximum,minimum,exclusiveMinimum,maxLength,minLength,pattern,additionalItems,maxItems,minItems,uniqueItems,maxProperties,minProperties,required,additionalProperties,enum,allOf,anyOf,oneOf,not") public class Schema extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Schema.BooleanOrSchemaArraySwap
Used during parsing to convert the
|
static class |
Schema.BooleanOrSchemaSwap
Used during parsing to convert the
|
static class |
Schema.JsonTypeOrJsonTypeArraySwap
Used during parsing to convert the
|
static class |
Schema.SchemaOrSchemaArraySwap
Used during parsing to convert the
|
Constructor and Description |
---|
Schema()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
Schema |
addAdditionalItems(Schema... additionalItems)
Bean property appender:
|
Schema |
addAllOf(Schema... allOf)
Bean property appender:
|
Schema |
addAnyOf(Schema... anyOf)
Bean property appender:
|
Schema |
addDefinition(String name,
Schema definition)
Bean property appender:
|
Schema |
addDependency(String name,
Schema dependency)
Bean property appender:
|
Schema |
addEnum(String... _enum)
Bean property appender:
|
Schema |
addItems(Schema... items)
Bean property appender:
|
Schema |
addOneOf(Schema... oneOf)
Bean property appender:
|
Schema |
addPatternProperties(SchemaProperty... properties)
Bean property appender:
|
Schema |
addProperties(Schema... properties)
Bean property appender:
|
Schema |
addRequired(List<String> required)
Bean property appender:
|
Schema |
addRequired(SchemaProperty... properties)
Bean property appender:
|
Schema |
addRequired(String... required)
Bean property appender:
|
Schema |
addTypes(JsonType... types)
Bean property appender:
|
Object |
getAdditionalItems()
Bean property getter:
|
Boolean |
getAdditionalItemsAsBoolean()
Bean property getter:
|
List<Schema> |
getAdditionalItemsAsSchemaArray()
Bean property getter:
|
Object |
getAdditionalProperties()
Bean property getter:
|
Boolean |
getAdditionalPropertiesAsBoolean()
Bean property getter:
|
Schema |
getAdditionalPropertiesAsSchema()
Bean property getter:
|
List<Schema> |
getAllOf()
Bean property getter:
|
List<Schema> |
getAnyOf()
Bean property getter:
|
Map<String,Schema> |
getDefinitions()
Bean property getter:
|
Map<String,Schema> |
getDependencies()
Bean property getter:
|
String |
getDescription()
Bean property getter:
|
List<String> |
getEnum()
Bean property getter:
|
URI |
getId()
Bean property getter:
|
Object |
getItems()
Bean property getter:
|
Schema |
getItemsAsSchema()
Bean property getter:
|
SchemaArray |
getItemsAsSchemaArray()
Bean property getter:
|
Number |
getMaximum()
Bean property getter:
|
Integer |
getMaxItems()
Bean property getter:
|
Integer |
getMaxLength()
Bean property getter:
|
Integer |
getMaxProperties()
Bean property getter:
|
Number |
getMinimum()
Bean property getter:
|
Integer |
getMinItems()
Bean property getter:
|
Integer |
getMinLength()
Bean property getter:
|
Integer |
getMinProperties()
Bean property getter:
|
Number |
getMultipleOf()
Bean property getter:
|
String |
getName()
Bean property getter:
|
Schema |
getNot()
Bean property getter:
|
List<Schema> |
getOneOf()
Bean property getter:
|
String |
getPattern()
Bean property getter:
|
Map<String,Schema> |
getPatternProperties()
Bean property getter:
|
Map<String,Schema> |
getProperties()
Bean property getter:
|
Schema |
getProperty(String name)
Returns the property with the specified name.
|
Schema |
getProperty(String name,
boolean resolve)
Returns the property with the specified name.
|
URI |
getRef()
Bean property getter:
|
List<String> |
getRequired()
Bean property getter:
|
URI |
getSchemaVersionUri()
Bean property getter:
|
String |
getTitle()
Bean property getter:
|
Object |
getType()
Bean property getter:
|
JsonType |
getTypeAsJsonType()
Bean property getter:
|
JsonTypeArray |
getTypeAsJsonTypeArray()
Bean property getter:
|
Boolean |
getUniqueItems()
Bean property getter:
|
Boolean |
isExclusiveMaximum()
Bean property getter:
|
Boolean |
isExclusiveMinimum()
Bean property getter:
|
Schema |
resolve()
If this schema is a reference to another schema (i.e.
|
Schema |
setAdditionalItems(Object additionalItems)
Bean property setter:
|
Schema |
setAdditionalProperties(Object additionalProperties)
Bean property setter:
|
Schema |
setAllOf(List<Schema> allOf)
Bean property setter:
|
Schema |
setAnyOf(List<Schema> anyOf)
Bean property setter:
|
Schema |
setDefinitions(Map<String,Schema> definitions)
Bean property setter:
|
Schema |
setDependencies(Map<String,Schema> dependencies)
Bean property setter:
|
Schema |
setDescription(String description)
Bean property setter:
|
Schema |
setEnum(List<String> _enum)
Bean property setter:
|
Schema |
setExclusiveMaximum(Boolean exclusiveMaximum)
Bean property setter:
|
Schema |
setExclusiveMinimum(Boolean exclusiveMinimum)
Bean property setter:
|
Schema |
setId(Object id)
Bean property setter:
|
Schema |
setItems(Object items)
Bean property setter:
|
protected void |
setMaster(Schema master)
Sets the master schema for this schema and all child schema objects.
|
Schema |
setMaximum(Number maximum)
Bean property setter:
|
Schema |
setMaxItems(Integer maxItems)
Bean property setter:
|
Schema |
setMaxLength(Integer maxLength)
Bean property setter:
|
Schema |
setMaxProperties(Integer maxProperties)
Bean property setter:
|
Schema |
setMinimum(Number minimum)
Bean property setter:
|
Schema |
setMinItems(Integer minItems)
Bean property setter:
|
Schema |
setMinLength(Integer minLength)
Bean property setter:
|
Schema |
setMinProperties(Integer minProperties)
Bean property setter:
|
Schema |
setMultipleOf(Number multipleOf)
Bean property setter:
|
Schema |
setName(String name)
Bean property setter:
|
Schema |
setNot(Schema not)
Bean property setter:
|
Schema |
setOneOf(List<Schema> oneOf)
Bean property setter:
|
Schema |
setPattern(String pattern)
Bean property setter:
|
Schema |
setPatternProperties(Map<String,Schema> patternProperties)
Bean property setter:
|
Schema |
setProperties(Map<String,Schema> properties)
Bean property setter:
|
Schema |
setRef(Object ref)
Bean property setter:
|
Schema |
setRequired(List<String> required)
Bean property setter:
|
Schema |
setSchemaMap(SchemaMap schemaMap)
Associates a schema map with this schema for resolving other schemas identified through
|
Schema |
setSchemaVersionUri(Object schemaVersion)
Bean property setter:
|
Schema |
setTitle(String title)
Bean property setter:
|
Schema |
setType(Object type)
Bean property setter:
|
Schema |
setUniqueItems(Boolean uniqueItems)
Bean property setter:
|
String |
toString() |
public Schema()
@BeanIgnore public String getName()
@BeanIgnore public Schema setName(String name)
name
- The new value for the public URI getId()
public Schema setId(Object id)
The value can be of any of the following types: URI
, URL
, String
.
Strings must be valid URIs.
URIs defined by UriResolver
can be used for values.
id
- The new value for the @BeanProperty(value="$schema") public URI getSchemaVersionUri()
@BeanProperty(value="$schema") public Schema setSchemaVersionUri(Object schemaVersion)
The value can be of any of the following types: URI
, URL
, String
.
Strings must be valid URIs.
URIs defined by UriResolver
can be used for values.
schemaVersion
- The new value for the public String getTitle()
public Schema setTitle(String title)
title
- The new value for the public String getDescription()
public Schema setDescription(String description)
description
- The new value for the @Swap(value=Schema.JsonTypeOrJsonTypeArraySwap.class) public Object getType()
JsonType
or JsonTypeArray
depending on what value was used to set it.@BeanIgnore public JsonType getTypeAsJsonType()
Convenience method for returning the JsonType
value.
JsonTypeArray
.@BeanIgnore public JsonTypeArray getTypeAsJsonTypeArray()
Convenience method for returning the JsonTypeArray
value.
JsonType
.public Schema setType(Object type)
type
- The new value for the JsonType
or JsonTypeArray
.BeanRuntimeException
- If invalid object type passed in.public Schema addTypes(JsonType... types)
types
- The list of items to append to the public Map<String,Schema> getDefinitions()
public Schema setDefinitions(Map<String,Schema> definitions)
definitions
- The new value for the public Schema addDefinition(String name, Schema definition)
name
- The key in the definitions map entry.definition
- The value in the definitions map entry.public Map<String,Schema> getProperties()
public Schema getProperty(String name)
This is equivalent to calling
name
- The property name.public Schema getProperty(String name, boolean resolve)
If resolve()
.
Therefore,
name
- The property name.resolve
- If resolve()
on object before returning.public Schema setProperties(Map<String,Schema> properties)
properties
- The new value for the public Schema addProperties(Schema... properties)
Properties must have their
properties
- The list of items to append to the BeanRuntimeException
- If property is found without a set public Map<String,Schema> getPatternProperties()
public Schema setPatternProperties(Map<String,Schema> patternProperties)
patternProperties
- The new value for the public Schema addPatternProperties(SchemaProperty... properties)
Properties must have their
properties
- The list of items to append to the BeanRuntimeException
- If property is found without a set public Map<String,Schema> getDependencies()
public Schema setDependencies(Map<String,Schema> dependencies)
dependencies
- The new value for the public Schema addDependency(String name, Schema dependency)
name
- The key of the entry in the dependencies map.dependency
- The value of the entry in the dependencies map.@Swap(value=Schema.SchemaOrSchemaArraySwap.class) public Object getItems()
Schema
or SchemaArray
depending on what value was used to set it.@BeanIgnore public Schema getItemsAsSchema()
Convenience method for returning the Schema
value.
SchemaArray
.@BeanIgnore public SchemaArray getItemsAsSchemaArray()
Convenience method for returning the SchemaArray
value.
Schema
.public Schema setItems(Object items)
items
- The new value for the Schema
or SchemaArray
.BeanRuntimeException
- If invalid object type passed in.public Schema addItems(Schema... items)
items
- The list of items to append to the public Number getMultipleOf()
public Schema setMultipleOf(Number multipleOf)
multipleOf
- The new value for the public Number getMaximum()
public Schema setMaximum(Number maximum)
maximum
- The new value for the public Boolean isExclusiveMaximum()
public Schema setExclusiveMaximum(Boolean exclusiveMaximum)
exclusiveMaximum
- The new value for the public Number getMinimum()
public Schema setMinimum(Number minimum)
minimum
- The new value for the public Boolean isExclusiveMinimum()
public Schema setExclusiveMinimum(Boolean exclusiveMinimum)
exclusiveMinimum
- The new value for the public Integer getMaxLength()
public Schema setMaxLength(Integer maxLength)
maxLength
- The new value for the public Integer getMinLength()
public Schema setMinLength(Integer minLength)
minLength
- The new value for the public String getPattern()
public Schema setPattern(String pattern)
pattern
- The new value for the @Swap(value=Schema.BooleanOrSchemaArraySwap.class) public Object getAdditionalItems()
Boolean
or SchemaArray
depending on what value was used to set it.@BeanIgnore public Boolean getAdditionalItemsAsBoolean()
Convenience method for returning the Boolean
value.
SchemaArray
.@BeanIgnore public List<Schema> getAdditionalItemsAsSchemaArray()
Convenience method for returning the SchemaArray
value.
Boolean
.public Schema setAdditionalItems(Object additionalItems)
additionalItems
- The new value for the Boolean
or SchemaArray
.BeanRuntimeException
- If invalid object type passed in.public Schema addAdditionalItems(Schema... additionalItems)
additionalItems
- The list of items to append to the public Integer getMaxItems()
public Schema setMaxItems(Integer maxItems)
maxItems
- The new value for the public Integer getMinItems()
public Schema setMinItems(Integer minItems)
minItems
- The new value for the public Boolean getUniqueItems()
public Schema setUniqueItems(Boolean uniqueItems)
uniqueItems
- The new value for the public Integer getMaxProperties()
public Schema setMaxProperties(Integer maxProperties)
maxProperties
- The new value for the public Integer getMinProperties()
public Schema setMinProperties(Integer minProperties)
minProperties
- The new value for the public List<String> getRequired()
public Schema setRequired(List<String> required)
required
- The new value for the public Schema addRequired(List<String> required)
required
- The list of items to append to the public Schema addRequired(String... required)
required
- The list of items to append to the public Schema addRequired(SchemaProperty... properties)
properties
- The list of items to append to the @Swap(value=Schema.BooleanOrSchemaSwap.class) public Object getAdditionalProperties()
Boolean
or SchemaArray
depending on what value was used to set it.@BeanIgnore public Boolean getAdditionalPropertiesAsBoolean()
Convenience method for returning the Boolean
value.
Schema
.@BeanIgnore public Schema getAdditionalPropertiesAsSchema()
Convenience method for returning the Schema
value.
Boolean
.@BeanProperty(beanDictionary=Schema.class) public Schema setAdditionalProperties(Object additionalProperties)
additionalProperties
- The new value for the Boolean
or Schema
.BeanRuntimeException
- If invalid object type passed in.public List<String> getEnum()
public Schema setEnum(List<String> _enum)
_enum
- The new value for the public Schema addEnum(String... _enum)
_enum
- The list of items to append to the public List<Schema> getAllOf()
public Schema setAllOf(List<Schema> allOf)
allOf
- The new value for the public Schema addAllOf(Schema... allOf)
allOf
- The list of items to append to the public List<Schema> getAnyOf()
public Schema setAnyOf(List<Schema> anyOf)
anyOf
- The new value of the public Schema addAnyOf(Schema... anyOf)
anyOf
- The list of items to append to the public List<Schema> getOneOf()
public Schema setOneOf(List<Schema> oneOf)
oneOf
- The new value for the public Schema addOneOf(Schema... oneOf)
oneOf
- The list of items to append to the public Schema getNot()
public Schema setNot(Schema not)
not
- The new value for the @BeanProperty(value="$ref") public URI getRef()
@BeanProperty(value="$ref") public Schema setRef(Object ref)
The value can be of any of the following types: URI
, URL
, String
.
Strings must be valid URIs.
URIs defined by UriResolver
can be used for values.
ref
- The new value for the protected void setMaster(Schema master)
All child elements in a schema should point to a single "master" schema in order to locate registered SchemaMap objects for resolving external schemas.
master
- The master schema to associate on this and all children. Can be public Schema resolve()
If this schema is not a reference, or no schema map is registered with this schema, this method is a no-op and simply returns this object.
public Schema setSchemaMap(SchemaMap schemaMap)
schemaMap
- The schema map to associate with this schema. Can be Copyright © 2018 Apache. All rights reserved.