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 aBaseReadOnlyService
.The converter recognize two cases:
Long
→ServiceBasedEntityConverter
andCollection
ofLong
toList
ofServiceBasedEntityConverter
usingBaseReadOnlyService.load(Long)
andBaseReadOnlyService.load(Collection)
respectively.The conversion also works with supertypes of
ServiceBasedEntityConverter
up toIdentifiable
.- Author:
- poirigui
- See Also:
BaseReadOnlyService.load(Long)
,BaseReadOnlyService.load(Collection)
-
-
Field Summary
Fields Modifier and Type Field Description protected Set<org.springframework.core.convert.converter.GenericConverter.ConvertiblePair>
convertibleTypes
-
Constructor Summary
Constructors Constructor Description ServiceBasedEntityConverter(BaseReadOnlyService<? extends O> service, Class<O> entityType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
convert(Object source, org.springframework.core.convert.TypeDescriptor sourceType, org.springframework.core.convert.TypeDescriptor targetType)
Set<org.springframework.core.convert.converter.GenericConverter.ConvertiblePair>
getConvertibleTypes()
boolean
matches(org.springframework.core.convert.TypeDescriptor sourceType, org.springframework.core.convert.TypeDescriptor targetType)
-
-
-
Field Detail
-
convertibleTypes
protected final Set<org.springframework.core.convert.converter.GenericConverter.ConvertiblePair> convertibleTypes
-
-
Constructor Detail
-
ServiceBasedEntityConverter
public ServiceBasedEntityConverter(BaseReadOnlyService<? extends O> service, Class<O> entityType)
-
-
Method Detail
-
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
-
getConvertibleTypes
public Set<org.springframework.core.convert.converter.GenericConverter.ConvertiblePair> getConvertibleTypes()
- Specified by:
getConvertibleTypes
in interfaceorg.springframework.core.convert.converter.GenericConverter
-
-