Package ubic.gemma.persistence.util
Class ServiceBasedEntityConverter<O extends Identifiable>
java.lang.Object
ubic.gemma.persistence.util.ServiceBasedEntityConverter<O>
- Type Parameters:
O- the type of entity this converter produces
- All Implemented Interfaces:
org.springframework.core.convert.converter.ConditionalConverter,org.springframework.core.convert.converter.ConditionalGenericConverter,org.springframework.core.convert.converter.GenericConverter
- Direct Known Subclasses:
ServiceBasedValueObjectConverter
public class ServiceBasedEntityConverter<O extends Identifiable>
extends Object
implements org.springframework.core.convert.converter.ConditionalGenericConverter
Performs conversion by identifier and collection of identifier for a
BaseReadOnlyService.
The converter recognize two cases: Long → ServiceBasedEntityConverter and Collection of Long to List
of ServiceBasedEntityConverter using BaseReadOnlyService.load(Long) and BaseReadOnlyService.load(Collection) respectively.
The conversion also works with supertypes of ServiceBasedEntityConverter up to Identifiable.
- Author:
- poirigui
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.core.convert.converter.GenericConverter
org.springframework.core.convert.converter.GenericConverter.ConvertiblePair -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Set<org.springframework.core.convert.converter.GenericConverter.ConvertiblePair> -
Constructor Summary
ConstructorsConstructorDescriptionServiceBasedEntityConverter(BaseReadOnlyService<? extends O> service, Class<O> entityType) -
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> booleanmatches(org.springframework.core.convert.TypeDescriptor sourceType, org.springframework.core.convert.TypeDescriptor targetType)
-
Field Details
-
convertibleTypes
protected final Set<org.springframework.core.convert.converter.GenericConverter.ConvertiblePair> convertibleTypes
-
-
Constructor Details
-
ServiceBasedEntityConverter
-
-
Method Details
-
matches
public boolean matches(org.springframework.core.convert.TypeDescriptor sourceType, org.springframework.core.convert.TypeDescriptor targetType) - Specified by:
matchesin interfaceorg.springframework.core.convert.converter.ConditionalConverter
-
getConvertibleTypes
public Set<org.springframework.core.convert.converter.GenericConverter.ConvertiblePair> getConvertibleTypes()- Specified by:
getConvertibleTypesin interfaceorg.springframework.core.convert.converter.GenericConverter
-
convert
public Object convert(@Nullable Object source, org.springframework.core.convert.TypeDescriptor sourceType, org.springframework.core.convert.TypeDescriptor targetType) - Specified by:
convertin interfaceorg.springframework.core.convert.converter.GenericConverter
-