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 CrudRepositorys. 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
ConstructorsConstructorDescriptionDomainClassConverter(T conversionService) Creates a newDomainClassConverterfor the givenConversionService. -
Method Summary
Modifier and TypeMethodDescriptionconvert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) booleanmatches(TypeDescriptor sourceType, TypeDescriptor targetType) voidsetApplicationContext(ApplicationContext context)
-
Constructor Details
-
DomainClassConverter
Creates a newDomainClassConverterfor the givenConversionService.- Parameters:
conversionService- must not be null.
-
-
Method Details
-
getConvertibleTypes
- Specified by:
getConvertibleTypesin interfaceGenericConverter
-
convert
@Nullable public Object convert(@Nullable Object source, TypeDescriptor sourceType, TypeDescriptor targetType) - Specified by:
convertin interfaceGenericConverter
-
matches
- Specified by:
matchesin interfaceConditionalConverter
-
setApplicationContext
- Specified by:
setApplicationContextin interfaceApplicationContextAware
-