Class DesignEnumConverter<T extends java.lang.Enum>
- java.lang.Object
-
- com.vaadin.ui.declarative.converters.DesignEnumConverter<T>
-
- All Implemented Interfaces:
Converter<java.lang.String,T>,java.io.Serializable
public class DesignEnumConverter<T extends java.lang.Enum> extends java.lang.Object implements Converter<java.lang.String,T>
An converter for Enum to/from String forDesignAttributeHandlerto use internally.- Since:
- 7.4
- Author:
- Vaadin Ltd
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DesignEnumConverter(java.lang.Class<T> type)Creates a converter for the given enum type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Result<T>convertToModel(java.lang.String value, ValueContext context)Converts the given value from model type to presentation type.java.lang.StringconvertToPresentation(T value, ValueContext context)Converts the given value from presentation type to model type.
-
-
-
Constructor Detail
-
DesignEnumConverter
public DesignEnumConverter(java.lang.Class<T> type)
Creates a converter for the given enum type.- Parameters:
type- the enum type to convert to/from
-
-
Method Detail
-
convertToModel
public Result<T> convertToModel(java.lang.String value, ValueContext context)
Description copied from interface:ConverterConverts the given value from model type to presentation type.A converter can optionally use locale to do the conversion.
- Specified by:
convertToModelin interfaceConverter<java.lang.String,T extends java.lang.Enum>- Parameters:
value- The value to convert. Can be nullcontext- The value context for the conversion.- Returns:
- The converted value compatible with the source type
-
convertToPresentation
public java.lang.String convertToPresentation(T value, ValueContext context)
Description copied from interface:ConverterConverts the given value from presentation type to model type.A converter can optionally use locale to do the conversion.
- Specified by:
convertToPresentationin interfaceConverter<java.lang.String,T extends java.lang.Enum>- Parameters:
value- The value to convert. Can be nullcontext- The value context for the conversion.- Returns:
- The converted value compatible with the source type
-
-