Class DomainClassConverter<T extends ConversionService & ConverterRegistry>
java.lang.Object
org.springframework.data.repository.support.DomainClassConverter<T>
- All Implemented Interfaces:
Aware
,ApplicationContextAware
,ConditionalConverter
,ConditionalGenericConverter
,GenericConverter
public class DomainClassConverter<T extends ConversionService & ConverterRegistry>
extends Object
implements ConditionalGenericConverter, ApplicationContextAware
Converter
to convert arbitrary input into domain classes managed
by Spring Data CrudRepository
s. The implementation uses a ConversionService
in turn to convert the
source type into the domain class' id type which is then converted into a domain class object by using a
CrudRepository
.- Author:
- Oliver Gierke, Thomas Darimont, Alessandro Nistico, Johannes Englmeier
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.core.convert.converter.GenericConverter
GenericConverter.ConvertiblePair
-
Constructor Summary
ConstructorDescriptionDomainClassConverter
(T conversionService) Creates a newDomainClassConverter
for the givenConversionService
. -
Method Summary
Modifier and TypeMethodDescriptionconvert
(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) boolean
matches
(TypeDescriptor sourceType, TypeDescriptor targetType) void
setApplicationContext
(ApplicationContext context)
-
Constructor Details
-
DomainClassConverter
Creates a newDomainClassConverter
for the givenConversionService
.- Parameters:
conversionService
- must not be null.
-
-
Method Details
-
getConvertibleTypes
- Specified by:
getConvertibleTypes
in interfaceGenericConverter
-
convert
@Nullable public Object convert(@Nullable Object source, TypeDescriptor sourceType, TypeDescriptor targetType) - Specified by:
convert
in interfaceGenericConverter
-
matches
- Specified by:
matches
in interfaceConditionalConverter
-
setApplicationContext
- Specified by:
setApplicationContext
in interfaceApplicationContextAware
-