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