ENUM_TYPE
- enum type to convert withpublic class StringEnumTypeConverter<ENUM_TYPE extends Enum> extends Object implements TypeConverter<String,ENUM_TYPE>
This one needs to be configured for each enum which needs to be converted.
If you want this to apply for all enums, use AutomaticStringEnumTypeConverter
.
Constructor and Description |
---|
StringEnumTypeConverter(Class<ENUM_TYPE> enumClass)
Construct a new type converter for the given enum type.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canConvert(Type realToType,
Type realDomainType)
Can this type converter handle conversions between the given transfer and domain object types?
|
ENUM_TYPE |
convert(String object,
SyntheticField domainField,
Object domainObject,
String... tags)
Convert a transfer object field value to the value for the domain object.
|
String |
reverse(ENUM_TYPE object,
SyntheticField toField,
Object toObject,
String... tags)
Convert a domain object field value to the value for the transfer object.
|
public boolean canConvert(Type realToType, Type realDomainType)
TypeConverter
canConvert
in interface TypeConverter<String,ENUM_TYPE extends Enum>
realToType
- real class for the type in the transfer objectrealDomainType
- real class for the type in the domain objectpublic ENUM_TYPE convert(String object, SyntheticField domainField, Object domainObject, String... tags) throws JTransfoException
TypeConverter
convert
in interface TypeConverter<String,ENUM_TYPE extends Enum>
object
- object to convertdomainField
- target domain fielddomainObject
- target domain objecttags
- tags which indicate which fields can be converted based on MapOnly
annotations.JTransfoException
- problem during type conversionpublic String reverse(ENUM_TYPE object, SyntheticField toField, Object toObject, String... tags) throws JTransfoException
TypeConverter
reverse
in interface TypeConverter<String,ENUM_TYPE extends Enum>
object
- object to converttoField
- target transfer object fieldtoObject
- target transfer objecttags
- tags which indicate which fields can be converted based on MapOnly
annotations.JTransfoException
- problem during type conversionCopyright © 2022. All rights reserved.