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:
ConditionalConverter
,ConditionalGenericConverter
,GenericConverter
- Direct Known Subclasses:
ServiceBasedValueObjectConverter
public class ServiceBasedEntityConverter<O extends Identifiable> extends Object implements 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)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.springframework.core.convert.converter.GenericConverter
GenericConverter.ConvertiblePair
-
-
Field Summary
Fields Modifier and Type Field Description protected Set<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, TypeDescriptor sourceType, TypeDescriptor targetType)
Set<GenericConverter.ConvertiblePair>
getConvertibleTypes()
boolean
matches(TypeDescriptor sourceType, TypeDescriptor targetType)
-
-
-
Field Detail
-
convertibleTypes
protected final Set<GenericConverter.ConvertiblePair> convertibleTypes
-
-
Constructor Detail
-
ServiceBasedEntityConverter
public ServiceBasedEntityConverter(BaseReadOnlyService<? extends O> service, Class<O> entityType)
-
-
Method Detail
-
matches
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType)
- Specified by:
matches
in interfaceConditionalConverter
-
getConvertibleTypes
public Set<GenericConverter.ConvertiblePair> getConvertibleTypes()
- Specified by:
getConvertibleTypes
in interfaceGenericConverter
-
convert
public Object convert(@Nullable Object source, TypeDescriptor sourceType, TypeDescriptor targetType)
- Specified by:
convert
in interfaceGenericConverter
-
-