Class TypedJsonSchemaObject
java.lang.Object
org.springframework.data.mongodb.core.schema.UntypedJsonSchemaObject
org.springframework.data.mongodb.core.schema.TypedJsonSchemaObject
- All Implemented Interfaces:
JsonSchemaObject
- Direct Known Subclasses:
TypedJsonSchemaObject.ArrayJsonSchemaObject
,TypedJsonSchemaObject.BooleanJsonSchemaObject
,TypedJsonSchemaObject.NumericJsonSchemaObject
,TypedJsonSchemaObject.ObjectJsonSchemaObject
,TypedJsonSchemaObject.StringJsonSchemaObject
A
JsonSchemaObject
of a given JsonSchemaObject.Type
.- Since:
- 2.1
- Author:
- Christoph Strobl, Mark Paluch, MichaĆ Kurcius
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
JsonSchemaObject
implementation oftype : 'array'
schema elements.
Provides programmatic access to schema specifics like range, minItems, maxItems,... via a fluent API producing immutableschema objects
.static class
JsonSchemaObject
implementation oftype : 'boolean'
schema elements.
Provides programmatic access to schema specifics via a fluent API producing immutableschema objects
.static class
JsonSchemaObject
implementation oftype : 'number'
,bsonType : 'int'
,bsonType : 'long'
,bsonType : 'double'
andbsonType : 'decimal128'
schema elements.
Provides programmatic access to schema specifics like multipleOf, minimum, maximum,... via a fluent API producing immutableschema objects
.static class
JsonSchemaObject
implementation oftype : 'object'
schema elements.
Provides programmatic access to schema specifics like required, properties, patternProperties,... via a fluent API producing immutableschema objects
.static class
JsonSchemaObject
implementation oftype : 'string'
schema elements.
Provides programmatic access to schema specifics like minLength, maxLength, pattern,... via a fluent API producing immutableschema objects
.Nested classes/interfaces inherited from interface org.springframework.data.mongodb.core.schema.JsonSchemaObject
JsonSchemaObject.Type
-
Field Summary
FieldsFields inherited from class org.springframework.data.mongodb.core.schema.UntypedJsonSchemaObject
description, generateDescription, restrictions
-
Method Summary
Modifier and TypeMethodDescriptionallOf
(Collection<JsonSchemaObject> allOf) The field value must match all specified schemas.anyOf
(Collection<JsonSchemaObject> anyOf) The field value must match at least one of the specified schemas.description
(String description) Set the description.Auto generate the description if not explicitly set.protected String
Customization hook for creating description out of defined values.
Called bytoDocument()
when no explicitdescription(java.lang.String)
is set.getTypes()
Get the set of types defined for this schema element.
TheSet
is likely to contain only one element in most cases.notMatch
(JsonSchemaObject notMatch) The field value must not match the specified schemas.static TypedJsonSchemaObject
of
(JsonSchemaObject.Type... types) Creates newTypedJsonSchemaObject
of given types.oneOf
(Collection<JsonSchemaObject> oneOf) The field value must match exactly one of the specified schemas.possibleValues
(Collection<? extends Object> possibleValues) enumerates all possible values of the field.org.bson.Document
Create the JSON schema complyingDocument
representation.Methods inherited from class org.springframework.data.mongodb.core.schema.UntypedJsonSchemaObject
newInstance
-
Field Details
-
types
-
-
Method Details
-
of
Creates newTypedJsonSchemaObject
of given types.- Parameters:
types
- must not be null.- Returns:
-
getTypes
Description copied from interface:JsonSchemaObject
Get the set of types defined for this schema element.
TheSet
is likely to contain only one element in most cases.- Specified by:
getTypes
in interfaceJsonSchemaObject
- Overrides:
getTypes
in classUntypedJsonSchemaObject
- Returns:
- never null.
-
description
Set the description.- Overrides:
description
in classUntypedJsonSchemaObject
- Parameters:
description
- must not be null.- Returns:
- new instance of
TypedJsonSchemaObject
.
-
generatedDescription
Auto generate the description if not explicitly set.- Overrides:
generatedDescription
in classUntypedJsonSchemaObject
- Returns:
- new instance of
TypedJsonSchemaObject
.
-
possibleValues
enumerates all possible values of the field.- Overrides:
possibleValues
in classUntypedJsonSchemaObject
- Parameters:
possibleValues
- must not be null.- Returns:
- new instance of
TypedJsonSchemaObject
.
-
allOf
The field value must match all specified schemas.- Overrides:
allOf
in classUntypedJsonSchemaObject
- Parameters:
allOf
- must not be null.- Returns:
- new instance of
TypedJsonSchemaObject
.
-
anyOf
The field value must match at least one of the specified schemas.- Overrides:
anyOf
in classUntypedJsonSchemaObject
- Parameters:
anyOf
- must not be null.- Returns:
- new instance of
TypedJsonSchemaObject
.
-
oneOf
The field value must match exactly one of the specified schemas.- Overrides:
oneOf
in classUntypedJsonSchemaObject
- Parameters:
oneOf
- must not be null.- Returns:
- new instance of
TypedJsonSchemaObject
.
-
notMatch
The field value must not match the specified schemas.- Overrides:
notMatch
in classUntypedJsonSchemaObject
- Parameters:
notMatch
- must not be null.- Returns:
- new instance of
TypedJsonSchemaObject
.
-
toDocument
public org.bson.Document toDocument()Create the JSON schema complyingDocument
representation. This includes type, description and the fields ofUntypedJsonSchemaObject.Restrictions.toDocument()
if set.- Specified by:
toDocument
in interfaceJsonSchemaObject
- Overrides:
toDocument
in classUntypedJsonSchemaObject
- Returns:
- never null.
-
generateDescription
Customization hook for creating description out of defined values.
Called bytoDocument()
when no explicitdescription(java.lang.String)
is set.- Overrides:
generateDescription
in classUntypedJsonSchemaObject
- Returns:
- can be null.
-