public interface MongoJsonSchemaCreator
MongoJsonSchemaCreator
extracts the MongoJsonSchema
for a given Class
by applying the
following mapping rules.
Required Properties
Transient
Object
-> 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. |
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 . |
MongoJsonSchema createSchemaFor(Class<?> type)
MongoJsonSchema
for the given type
.type
- must not be null.MongoJsonSchemaCreator filter(Predicate<MongoJsonSchemaCreator.JsonSchemaPropertyContext> filter)
properties
.filter
- the Predicate
to evaluate for inclusion. Must not be null.MongoJsonSchemaCreator
.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–2021 Pivotal Software, Inc.. All rights reserved.