Class DomainClassConverter<T extends org.springframework.core.convert.ConversionService & org.springframework.core.convert.converter.ConverterRegistry>
java.lang.Object
org.springframework.data.repository.support.DomainClassConverter<T>
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
,org.springframework.core.convert.converter.ConditionalConverter
,org.springframework.core.convert.converter.ConditionalGenericConverter
,org.springframework.core.convert.converter.GenericConverter
public class DomainClassConverter<T extends org.springframework.core.convert.ConversionService & org.springframework.core.convert.converter.ConverterRegistry>
extends Object
implements org.springframework.core.convert.converter.ConditionalGenericConverter, org.springframework.context.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
org.springframework.core.convert.converter.GenericConverter.ConvertiblePair
-
Constructor Summary
ConstructorDescriptionDomainClassConverter
(T conversionService) Creates a newDomainClassConverter
for the givenConversionService
. -
Method Summary
Modifier and TypeMethodDescriptionconvert
(Object source, org.springframework.core.convert.TypeDescriptor sourceType, org.springframework.core.convert.TypeDescriptor targetType) Set<org.springframework.core.convert.converter.GenericConverter.ConvertiblePair>
boolean
matches
(org.springframework.core.convert.TypeDescriptor sourceType, org.springframework.core.convert.TypeDescriptor targetType) void
setApplicationContext
(org.springframework.context.ApplicationContext context)
-
Constructor Details
-
DomainClassConverter
Creates a newDomainClassConverter
for the givenConversionService
.- Parameters:
conversionService
- must not be null.
-
-
Method Details
-
getConvertibleTypes
@NonNull public Set<org.springframework.core.convert.converter.GenericConverter.ConvertiblePair> getConvertibleTypes()- Specified by:
getConvertibleTypes
in interfaceorg.springframework.core.convert.converter.GenericConverter
-
convert
@Nullable public Object convert(@Nullable Object source, org.springframework.core.convert.TypeDescriptor sourceType, org.springframework.core.convert.TypeDescriptor targetType) - Specified by:
convert
in interfaceorg.springframework.core.convert.converter.GenericConverter
-
matches
public boolean matches(org.springframework.core.convert.TypeDescriptor sourceType, org.springframework.core.convert.TypeDescriptor targetType) - Specified by:
matches
in interfaceorg.springframework.core.convert.converter.ConditionalConverter
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext context) - Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
-