|
Spring Data Document | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.data.mongodb.core.convert.CustomConversions
public class CustomConversions
Value object to capture custom conversion. That is essentially a List
of converters and some additional logic
around them. The converters are pretty much builds up two sets of types which Mongo basic types #MONGO_TYPES
can be converted into and from. These types will be considered simple ones (which means they neither need deeper
inspection nor nested conversion. Thus the CustomConversions
also act as factory for SimpleTypeHolder
.
Constructor Summary | |
---|---|
CustomConversions(List<?> converters)
Creates a new CustomConversions instance registering the given converters. |
Method Summary | |
---|---|
Class<?> |
getCustomWriteTarget(Class<?> source)
Returns the target type to convert to in case we have a custom conversion registered to convert the given source type into a Mongo native one. |
Class<?> |
getCustomWriteTarget(Class<?> source,
Class<?> expectedTargetType)
Returns the target type we can write an onject of the given source type to. |
org.springframework.data.mapping.model.SimpleTypeHolder |
getSimpleTypeHolder()
Returns the underlying SimpleTypeHolder . |
boolean |
hasCustomReadTarget(Class<?> source,
Class<?> expectedTargetType)
Returns whether we have a custom conversion registered to read the given source into the given target type. |
boolean |
hasCustomWriteTarget(Class<?> source)
Returns whether we have a custom conversion registered to write into a Mongo native type. |
boolean |
hasCustomWriteTarget(Class<?> source,
Class<?> expectedTargetType)
Returns whether we have a custom conversion registered to write an object of the given source type into an object of the given Mongo native target type. |
boolean |
isSimpleType(Class<?> type)
Returns whether the given type is considered to be simple. |
void |
registerConvertersIn(GenericConversionService conversionService)
Populates the given GenericConversionService with the convertes registered. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CustomConversions(List<?> converters)
CustomConversions
instance registering the given converters.
converters
- Method Detail |
---|
public org.springframework.data.mapping.model.SimpleTypeHolder getSimpleTypeHolder()
SimpleTypeHolder
.
public boolean isSimpleType(Class<?> type)
Converter
registered for a particular type.
type
-
SimpleTypeHolder.isSimpleType(Class)
public void registerConvertersIn(GenericConversionService conversionService)
GenericConversionService
with the convertes registered.
conversionService
- public Class<?> getCustomWriteTarget(Class<?> source)
source
- must not be null
public Class<?> getCustomWriteTarget(Class<?> source, Class<?> expectedTargetType)
expexctedTargetType
is null we will simply return the
first target type matching or null if no conversion can be found.
source
- must not be nullexpectedTargetType
-
public boolean hasCustomWriteTarget(Class<?> source)
source
- must not be null
public boolean hasCustomWriteTarget(Class<?> source, Class<?> expectedTargetType)
source
- must not be null.expectedTargetType
-
public boolean hasCustomReadTarget(Class<?> source, Class<?> expectedTargetType)
source
- must not be nullexpectedTargetType
- must not be null
|
Spring Data Document | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |