public interface MongoJsonSchemaCreator
MongoJsonSchemaCreator extracts the MongoJsonSchema for a given Class by applying the
following mapping rules.
Required Properties
TransientObject -> type : 'object'Arrays -> type : 'array'Collection -> type : 'array'Map -> type : 'object'Enum -> type : 'string', enum : [the enum values]type : 'the corresponding bson type' type : 'object', properties : {the types properties} _id properties using types that can be converted into
ObjectId like String will be mapped to type : 'object' unless there is more
specific information available via the MongoId annotation.
Encrypted properties will contain encrypt information.| Modifier and Type | Interface and Description |
|---|---|
static interface |
MongoJsonSchemaCreator.JsonSchemaPropertyContext
The context in which a specific
MongoJsonSchemaCreator.JsonSchemaPropertyContext.getProperty() is encountered during schema creation. |
static interface |
MongoJsonSchemaCreator.PropertySpecifier |
| Modifier and Type | Method and Description |
|---|---|
static MongoJsonSchemaCreator |
create()
Creates a new
MongoJsonSchemaCreator that does not consider potential extensions - suitable for testing. |
static MongoJsonSchemaCreator |
create(MappingContext mappingContext)
Creates a new
MongoJsonSchemaCreator that is aware of type mappings and potential
extensions. |
static MongoJsonSchemaCreator |
create(MongoConverter mongoConverter)
Creates a new
MongoJsonSchemaCreator that is aware of conversions applied by the given
MongoConverter. |
MongoJsonSchema |
createSchemaFor(Class<?> type)
Create the
MongoJsonSchema for the given type. |
static Predicate<MongoJsonSchemaCreator.JsonSchemaPropertyContext> |
encryptedOnly()
A filter
Predicate that matches encrypted properties and those having nested ones. |
MongoJsonSchemaCreator |
filter(Predicate<MongoJsonSchemaCreator.JsonSchemaPropertyContext> filter)
Filter matching
properties. |
default MongoJsonSchema |
mergedSchemaFor(Class<?>... types)
Create a merged
MongoJsonSchema out of the individual schemas of the given types by merging their
properties into one large schema. |
MongoJsonSchemaCreator.PropertySpecifier |
property(String path)
Entry point to specify additional behavior for a given path.
|
MongoJsonSchema createSchemaFor(Class<?> type)
MongoJsonSchema for the given type.type - must not be null.default MongoJsonSchema mergedSchemaFor(Class<?>... types)
MongoJsonSchema out of the individual schemas of the given types by merging their
properties into one large schema.types - must not be null nor contain null.MongoJsonSchema.MongoJsonSchemaCreator filter(Predicate<MongoJsonSchemaCreator.JsonSchemaPropertyContext> filter)
properties.filter - the Predicate to evaluate for inclusion. Must not be null.MongoJsonSchemaCreator.MongoJsonSchemaCreator.PropertySpecifier property(String path)
path - the path using dot '.' notation.MongoJsonSchemaCreator.PropertySpecifier.static Predicate<MongoJsonSchemaCreator.JsonSchemaPropertyContext> encryptedOnly()
Predicate that matches encrypted properties and those having nested ones.Predicate.static MongoJsonSchemaCreator create(MongoConverter mongoConverter)
MongoJsonSchemaCreator that is aware of conversions applied by the given
MongoConverter.mongoConverter - must not be null.MongoJsonSchemaCreator.static MongoJsonSchemaCreator create(MappingContext mappingContext)
MongoJsonSchemaCreator that is aware of type mappings and potential
extensions.mappingContext - must not be null.MongoJsonSchemaCreator.static MongoJsonSchemaCreator create()
MongoJsonSchemaCreator that does not consider potential extensions - suitable for testing. We
recommend to use create(MappingContext).MongoJsonSchemaCreator.Copyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.