|
Spring Data Commons | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.data.convert.DefaultTypeMapper<S>
public class DefaultTypeMapper<S>
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.
Constructor Summary | |
---|---|
DefaultTypeMapper(TypeAliasAccessor<S> accessor)
|
|
DefaultTypeMapper(TypeAliasAccessor<S> accessor,
java.util.List<? extends TypeInformationMapper> mappers)
|
|
DefaultTypeMapper(TypeAliasAccessor<S> accessor,
MappingContext<? extends PersistentEntity<?,?>,?> mappingContext,
java.util.List<? extends TypeInformationMapper> additionalMappers)
|
Method Summary | ||
---|---|---|
protected TypeInformation<?> |
getFallbackTypeFor(S source)
Returns the type fallback TypeInformation in case none could be extracted from the given source. |
|
TypeInformation<?> |
readType(S source)
Reads the TypeInformation from the given source. |
|
|
readType(S source,
TypeInformation<T> basicType)
Returns the TypeInformation from the given source if it is a more concrete type than the given default one. |
|
void |
writeType(java.lang.Class<?> type,
S dbObject)
Writes type information for the given type into the given sink. |
|
void |
writeType(TypeInformation<?> info,
S sink)
Writes type information for the given TypeInformation into the given sink. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultTypeMapper(TypeAliasAccessor<S> accessor)
public DefaultTypeMapper(TypeAliasAccessor<S> accessor, java.util.List<? extends TypeInformationMapper> mappers)
public DefaultTypeMapper(TypeAliasAccessor<S> accessor, MappingContext<? extends PersistentEntity<?,?>,?> mappingContext, java.util.List<? extends TypeInformationMapper> additionalMappers)
Method Detail |
---|
public TypeInformation<?> readType(S source)
TypeMapper
TypeInformation
from the given source.
readType
in interface TypeMapper<S>
source
- must not be null.
public <T> TypeInformation<? extends T> readType(S source, TypeInformation<T> basicType)
TypeMapper
TypeInformation
from the given source if it is a more concrete type than the given default one.
readType
in interface TypeMapper<S>
source
- must not be null.
protected TypeInformation<?> getFallbackTypeFor(S source)
TypeInformation
in case none could be extracted from the given source.
source
- will never be null.
public void writeType(java.lang.Class<?> type, S dbObject)
TypeMapper
writeType
in interface TypeMapper<S>
type
- must not be null.dbObject
- must not be null.public void writeType(TypeInformation<?> info, S sink)
TypeMapper
TypeInformation
into the given sink.
writeType
in interface TypeMapper<S>
info
- must not be null.sink
- must not be null.
|
Spring Data Commons | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |