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:
org.springframework.data.convert.TypeMapper<com.mongodb.DBObject>, MongoTypeMapper

public class DefaultMongoTypeMapper
extends org.springframework.data.convert.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 org.springframework.data.convert.TypeInformationMapper> mappers)
           
DefaultMongoTypeMapper(String typeKey, org.springframework.data.mapping.context.MappingContext<? extends org.springframework.data.mapping.PersistentEntity<?,?>,?> mappingContext)
           
 
Method Summary
protected  org.springframework.data.util.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,
                              org.springframework.data.mapping.context.MappingContext<? extends org.springframework.data.mapping.PersistentEntity<?,?>,?> mappingContext)

DefaultMongoTypeMapper

public DefaultMongoTypeMapper(String typeKey,
                              List<? extends org.springframework.data.convert.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 org.springframework.data.util.TypeInformation<?> getFallbackTypeFor(com.mongodb.DBObject source)
Overrides:
getFallbackTypeFor in class org.springframework.data.convert.DefaultTypeMapper<com.mongodb.DBObject>


Copyright © 2011. All Rights Reserved.