final class EnumToStringConverter extends java.lang.Object implements Converter<java.lang.Enum<?>,java.lang.String>, ConditionalConverter
Enum.name()
to convert a source Enum to a String.
This converter will not match enums with interfaces that can be converted.Modifier and Type | Field and Description |
---|---|
private ConversionService |
conversionService |
Constructor and Description |
---|
EnumToStringConverter(ConversionService conversionService) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
convert(java.lang.Enum<?> source)
Convert the source object of type
S to target type T . |
boolean |
matches(TypeDescriptor sourceType,
TypeDescriptor targetType)
Should the conversion from
sourceType to targetType currently under
consideration be selected? |
private final ConversionService conversionService
public EnumToStringConverter(ConversionService conversionService)
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType)
ConditionalConverter
sourceType
to targetType
currently under
consideration be selected?matches
in interface ConditionalConverter
sourceType
- the type descriptor of the field we are converting fromtargetType
- the type descriptor of the field we are converting topublic java.lang.String convert(java.lang.Enum<?> source)
Converter
S
to target type T
.