Package ubic.gemma.persistence.util
Class ServiceBasedValueObjectConverter<O extends Identifiable,VO extends IdentifiableValueObject<O>>
- java.lang.Object
-
- ubic.gemma.persistence.util.ServiceBasedEntityConverter<O>
-
- ubic.gemma.persistence.util.ServiceBasedValueObjectConverter<O,VO>
-
- Type Parameters:
O
- the type of value object this converter consumes and also produces (as inherited fromServiceBasedEntityConverter
VO
- the type of value object this converter produces
- All Implemented Interfaces:
ConditionalConverter
,ConditionalGenericConverter
,GenericConverter
public class ServiceBasedValueObjectConverter<O extends Identifiable,VO extends IdentifiableValueObject<O>> extends ServiceBasedEntityConverter<O> implements ConditionalGenericConverter
Perform conversion to value object by entity, ID and collections of entities and IDs and also to entity by ID and collection of IDs.The converter recognize two cases: converting
ServiceBasedValueObjectConverter
→ServiceBasedValueObjectConverter
and convertingCollection
ofServiceBasedValueObjectConverter
toList
ofServiceBasedValueObjectConverter
by calling respectivelyBaseVoEnabledService.loadValueObject(Identifiable)
andBaseVoEnabledService.loadValueObjects(Collection)
.This implementation also work with supertypes of the designated
ServiceBasedValueObjectConverter
and subtypes of theServiceBasedValueObjectConverter
. For example, you can perform generic conversion toIdentifiableValueObject
without having to mention the specific type of value object you ultimately want.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.springframework.core.convert.converter.GenericConverter
GenericConverter.ConvertiblePair
-
-
Field Summary
-
Fields inherited from class ubic.gemma.persistence.util.ServiceBasedEntityConverter
convertibleTypes
-
-
Constructor Summary
Constructors Constructor Description ServiceBasedValueObjectConverter(BaseVoEnabledService<O,? extends VO> service, Class<O> sourceType, Class<VO> targetType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
convert(Object object, TypeDescriptor sourceType, TypeDescriptor targetType)
boolean
matches(TypeDescriptor sourceType, TypeDescriptor targetType)
-
Methods inherited from class ubic.gemma.persistence.util.ServiceBasedEntityConverter
getConvertibleTypes
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.springframework.core.convert.converter.GenericConverter
getConvertibleTypes
-
-
-
-
Method Detail
-
matches
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType)
- Specified by:
matches
in interfaceConditionalConverter
- Overrides:
matches
in classServiceBasedEntityConverter<O extends Identifiable>
-
convert
public Object convert(@Nullable Object object, TypeDescriptor sourceType, TypeDescriptor targetType)
- Specified by:
convert
in interfaceGenericConverter
- Overrides:
convert
in classServiceBasedEntityConverter<O extends Identifiable>
-
-