public class DefaultMongoTypeMapper extends DefaultTypeMapper<com.mongodb.DBObject> implements MongoTypeMapper
MongoTypeMapper allowing configuration of the key to lookup and store type
information in DBObject. The key defaults to DEFAULT_TYPE_KEY. Actual type-to-String
conversion and back is done in #getTypeString(TypeInformation) or #getTypeInformation(String)
respectively.| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultMongoTypeMapper.DBObjectTypeAliasAccessor
TypeAliasAccessor to store aliases in a DBObject. |
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_TYPE_KEY |
| Constructor and Description |
|---|
DefaultMongoTypeMapper() |
DefaultMongoTypeMapper(String typeKey) |
DefaultMongoTypeMapper(String typeKey,
List<? extends TypeInformationMapper> mappers) |
DefaultMongoTypeMapper(String typeKey,
MappingContext<? extends PersistentEntity<?,?>,?> mappingContext) |
| Modifier and Type | Method and Description |
|---|---|
protected TypeInformation<?> |
getFallbackTypeFor(com.mongodb.DBObject source) |
boolean |
isTypeKey(String key)
Returns whether the given key is the type key.
|
void |
writeTypeRestrictions(com.mongodb.DBObject result,
Set<Class<?>> restrictedTypes)
Writes type restrictions to the given
DBObject. |
getAliasFor, readType, readType, writeType, writeTypeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitreadType, readType, writeType, writeTypepublic static final String DEFAULT_TYPE_KEY
public DefaultMongoTypeMapper()
public DefaultMongoTypeMapper(String typeKey)
public DefaultMongoTypeMapper(String typeKey, MappingContext<? extends PersistentEntity<?,?>,?> mappingContext)
public DefaultMongoTypeMapper(String typeKey, List<? extends TypeInformationMapper> mappers)
public boolean isTypeKey(String key)
MongoTypeMapperisTypeKey in interface MongoTypeMapperpublic void writeTypeRestrictions(com.mongodb.DBObject result,
Set<Class<?>> restrictedTypes)
MongoTypeMapperDBObject. This usually results in an $in-clause to be
generated that restricts the type-key (e.g. _class) to be in the set of type aliases for the given
restrictedTypes.writeTypeRestrictions in interface MongoTypeMapperresult - must not be nullrestrictedTypes - must not be nullprotected TypeInformation<?> getFallbackTypeFor(com.mongodb.DBObject source)
getFallbackTypeFor in class DefaultTypeMapper<com.mongodb.DBObject>Copyright © 2011–2018 Pivotal Software, Inc.. All rights reserved.