Spring Data MongoDB

org.springframework.data.mongodb.core.convert
Class DefaultMongoTypeMapper

java.lang.Object
  extended by org.springframework.data.convert.DefaultTypeMapper<com.mongodb.DBObject>
      extended by org.springframework.data.mongodb.core.convert.DefaultMongoTypeMapper
All Implemented Interfaces:
TypeMapper<com.mongodb.DBObject>, MongoTypeMapper

public class DefaultMongoTypeMapper
extends DefaultTypeMapper<com.mongodb.DBObject>
implements MongoTypeMapper

Default implementation of 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.

Author:
Oliver Gierke

Nested Class Summary
static class DefaultMongoTypeMapper.DBObjectTypeAliasAccessor
           
 
Field Summary
static String DEFAULT_TYPE_KEY
           
 
Constructor Summary
DefaultMongoTypeMapper()
           
DefaultMongoTypeMapper(String typeKey)
           
DefaultMongoTypeMapper(String typeKey, List<? extends TypeInformationMapper> mappers)
           
DefaultMongoTypeMapper(String typeKey, MappingContext<? extends PersistentEntity<?,?>,?> mappingContext)
           
 
Method Summary
protected  TypeInformation<?> getFallbackTypeFor(com.mongodb.DBObject source)
           
 boolean isTypeKey(String key)
          Returns whether the given key is the type key.
 
Methods inherited from class org.springframework.data.convert.DefaultTypeMapper
readType, readType, writeType, writeType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.data.convert.TypeMapper
readType, readType, writeType, writeType
 

Field Detail

DEFAULT_TYPE_KEY

public static final String DEFAULT_TYPE_KEY
See Also:
Constant Field Values
Constructor Detail

DefaultMongoTypeMapper

public DefaultMongoTypeMapper()

DefaultMongoTypeMapper

public DefaultMongoTypeMapper(String typeKey)

DefaultMongoTypeMapper

public DefaultMongoTypeMapper(String typeKey,
                              MappingContext<? extends PersistentEntity<?,?>,?> mappingContext)

DefaultMongoTypeMapper

public DefaultMongoTypeMapper(String typeKey,
                              List<? extends TypeInformationMapper> mappers)
Method Detail

isTypeKey

public boolean isTypeKey(String key)
Description copied from interface: MongoTypeMapper
Returns whether the given key is the type key.

Specified by:
isTypeKey in interface MongoTypeMapper
Returns:

getFallbackTypeFor

protected TypeInformation<?> getFallbackTypeFor(com.mongodb.DBObject source)
Overrides:
getFallbackTypeFor in class DefaultTypeMapper<com.mongodb.DBObject>

Spring Data MongoDB

Copyright © 2011-2013-2013 SpringSource. All Rights Reserved.