Package org.jmolecules.spring
Class PrimitivesToIdentifierConverter
java.lang.Object
org.jmolecules.spring.PrimitivesToIdentifierConverter
- All Implemented Interfaces:
org.springframework.core.convert.converter.ConditionalConverter,org.springframework.core.convert.converter.ConditionalGenericConverter,org.springframework.core.convert.converter.GenericConverter
public class PrimitivesToIdentifierConverter
extends Object
implements org.springframework.core.convert.converter.ConditionalGenericConverter
A Spring
Converter to convert primitives like String and UUID values to jMolecules
Identifier instances, assuming they expose a static factory method of(…).- Author:
- Oliver Drotbohm
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.core.convert.converter.GenericConverter
org.springframework.core.convert.converter.GenericConverter.ConvertiblePair -
Constructor Summary
ConstructorsConstructorDescriptionPrimitivesToIdentifierConverter(Supplier<? extends org.springframework.core.convert.ConversionService> conversionService) Creates a newPrimitivesToIdentifierConverterfor the givenConversionService. -
Method Summary
Modifier and TypeMethodDescriptionconvert(Object source, org.springframework.core.convert.TypeDescriptor sourceType, org.springframework.core.convert.TypeDescriptor target) Set<org.springframework.core.convert.converter.GenericConverter.ConvertiblePair>booleanmatches(org.springframework.core.convert.TypeDescriptor source, org.springframework.core.convert.TypeDescriptor target)
-
Constructor Details
-
PrimitivesToIdentifierConverter
public PrimitivesToIdentifierConverter(Supplier<? extends org.springframework.core.convert.ConversionService> conversionService) Creates a newPrimitivesToIdentifierConverterfor the givenConversionService.- Parameters:
conversionService- must not be null.
-
-
Method Details
-
getConvertibleTypes
@NonNull public Set<org.springframework.core.convert.converter.GenericConverter.ConvertiblePair> getConvertibleTypes()- Specified by:
getConvertibleTypesin interfaceorg.springframework.core.convert.converter.GenericConverter
-
matches
public boolean matches(org.springframework.core.convert.TypeDescriptor source, org.springframework.core.convert.TypeDescriptor target) - Specified by:
matchesin interfaceorg.springframework.core.convert.converter.ConditionalConverter
-
convert
@Nullable public Object convert(@Nullable Object source, org.springframework.core.convert.TypeDescriptor sourceType, org.springframework.core.convert.TypeDescriptor target) - Specified by:
convertin interfaceorg.springframework.core.convert.converter.GenericConverter
-