Module spring.data.mongodb
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 classJsonSchemaObjectimplementation oftype : 'array'schema elements.
Provides programmatic access to schema specifics like range, minItems, maxItems,... via a fluent API producing immutableschema objects.static classJsonSchemaObjectimplementation oftype : 'boolean'schema elements.
Provides programmatic access to schema specifics via a fluent API producing immutableschema objects.static classJsonSchemaObjectimplementation 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 classJsonSchemaObjectimplementation oftype : 'object'schema elements.
Provides programmatic access to schema specifics like required, properties, patternProperties,... via a fluent API producing immutableschema objects.static classJsonSchemaObjectimplementation 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 StringCustomization 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.
TheSetis likely to contain only one element in most cases.notMatch(JsonSchemaObject notMatch) The field value must not match the specified schemas.static TypedJsonSchemaObjectof(JsonSchemaObject.Type... types) Creates newTypedJsonSchemaObjectof 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.DocumentCreate the JSON schema complyingDocumentrepresentation.Methods inherited from class org.springframework.data.mongodb.core.schema.UntypedJsonSchemaObject
newInstance
-
Field Details
-
types
-
-
Method Details
-
of
Creates newTypedJsonSchemaObjectof given types.- Parameters:
types- must not be null.- Returns:
-
getTypes
Description copied from interface:JsonSchemaObjectGet the set of types defined for this schema element.
TheSetis likely to contain only one element in most cases.- Specified by:
getTypesin interfaceJsonSchemaObject- Overrides:
getTypesin classUntypedJsonSchemaObject- Returns:
- never null.
-
description
Set the description.- Overrides:
descriptionin classUntypedJsonSchemaObject- Parameters:
description- must not be null.- Returns:
- new instance of
TypedJsonSchemaObject.
-
generatedDescription
Auto generate the description if not explicitly set.- Overrides:
generatedDescriptionin classUntypedJsonSchemaObject- Returns:
- new instance of
TypedJsonSchemaObject.
-
possibleValues
enumerates all possible values of the field.- Overrides:
possibleValuesin classUntypedJsonSchemaObject- Parameters:
possibleValues- must not be null.- Returns:
- new instance of
TypedJsonSchemaObject.
-
allOf
The field value must match all specified schemas.- Overrides:
allOfin 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:
anyOfin 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:
oneOfin classUntypedJsonSchemaObject- Parameters:
oneOf- must not be null.- Returns:
- new instance of
TypedJsonSchemaObject.
-
notMatch
The field value must not match the specified schemas.- Overrides:
notMatchin classUntypedJsonSchemaObject- Parameters:
notMatch- must not be null.- Returns:
- new instance of
TypedJsonSchemaObject.
-
toDocument
public org.bson.Document toDocument()Create the JSON schema complyingDocumentrepresentation. This includes type, description and the fields ofUntypedJsonSchemaObject.Restrictions.toDocument()if set.- Specified by:
toDocumentin interfaceJsonSchemaObject- Overrides:
toDocumentin 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:
generateDescriptionin classUntypedJsonSchemaObject- Returns:
- can be null.
-