public class MongoJsonSchema
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
MongoJsonSchema.ScalarProperties |
| Modifier and Type | Field and Description |
|---|---|
boolean |
additionalProperties |
java.util.Set<MongoJsonSchema> |
anyOf |
java.lang.String |
bsonType |
MongoJsonSchema |
items |
java.util.Map<java.lang.String,MongoJsonSchema> |
properties |
java.util.Set<java.lang.String> |
required |
| Constructor and Description |
|---|
MongoJsonSchema() |
| Modifier and Type | Method and Description |
|---|---|
void |
addScalarKeys(MongoJsonSchema.ScalarProperties... scalarProperties)
Adds scalar properties to a MongoJsonSchema.
|
static MongoJsonSchema |
createEmptyObjectSchema() |
static MongoJsonSchema |
createScalarSchema(java.lang.String type) |
boolean |
equals(java.lang.Object obj) |
BsonTypeInfo |
getBsonTypeInfo()
Gets the bson type for this schema as a BsonTypeInfo enum value.
|
int |
getColumnNullability(java.lang.String columnName)
Gets the nullability of a column (field) in this schemas list of properties.
|
int |
hashCode() |
boolean |
isAny() |
boolean |
isObject() |
static MongoJsonSchema |
toSimplifiedMongoJsonSchema(JsonSchema baseSchema)
Converts a deserialized jsonSchema into a MongoJsonSchema.
|
java.lang.String |
toString() |
public java.lang.String bsonType
public java.util.Map<java.lang.String,MongoJsonSchema> properties
public java.util.Set<MongoJsonSchema> anyOf
public java.util.Set<java.lang.String> required
public MongoJsonSchema items
public boolean additionalProperties
public static MongoJsonSchema toSimplifiedMongoJsonSchema(JsonSchema baseSchema)
baseSchema - The base json schema.public static MongoJsonSchema createEmptyObjectSchema()
public static MongoJsonSchema createScalarSchema(java.lang.String type)
@SafeVarargs public final void addScalarKeys(MongoJsonSchema.ScalarProperties... scalarProperties)
{
"bsonType": "object",
"properties": {
"bar": { "bsonType": "int" }
}
}
will become
{
"bsonType": "object",
"properties": {
"bar": { "bsonType": "int" },
"foo": { "bsonType": "bool" }
},
"required": [foo]
}
scalarProperties - Contains the basic info (name, bsonType and required flag) for each
key. Each property is converted into a scalar MongoJsonSchema and added to this parent
schema.public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean isAny()
public boolean isObject()
public int getColumnNullability(java.lang.String columnName)
throws java.sql.SQLException
columnName - The name of the column (or "field") for which to return nullability
informationjava.sql.SQLException - If the argued column is not in this schema, or if this schema is invalid@BsonIgnore public BsonTypeInfo getBsonTypeInfo() throws java.sql.SQLException
java.sql.SQLException - If this schema is invalid