com.vaadin.ui.declarative.converters.

Class DesignEnumConverter<T extends Enum>

    • Constructor Detail

      • DesignEnumConverter

        public DesignEnumConverter​(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​(String value,
                                        ValueContext context)

        Description copied from interface: Converter

        Converts the given value from model type to presentation type.

        A converter can optionally use locale to do the conversion.

        Specified by:

        convertToModel in interface Converter<String,​T extends Enum>

        Parameters:

        value - The value to convert. Can be null

        context - The value context for the conversion.

        Returns:

        The converted value compatible with the source type

      • convertToPresentation

        public String convertToPresentation​(T value,
                                            ValueContext context)

        Description copied from interface: Converter

        Converts the given value from presentation type to model type.

        A converter can optionally use locale to do the conversion.

        Specified by:

        convertToPresentation in interface Converter<String,​T extends Enum>

        Parameters:

        value - The value to convert. Can be null

        context - The value context for the conversion.

        Returns:

        The converted value compatible with the source type