Class StringToEnumConverter

java.lang.Object
com.vaadin.featurepack.data.converter.StringToEnumConverter
All Implemented Interfaces:
Converter<String,Enum>, com.vaadin.flow.data.converter.Converter<String,Enum>, Serializable

public class StringToEnumConverter extends Object implements Converter<String,Enum>
A converter that converts from String to an Enum and back.

Designed to provide nice human readable strings for Enum classes conforming to one of these patterns:

  • The constants are named SOME_UPPERCASE_WORDS and there's no toString implementation.
  • toString() always returns the same human readable string that is not the same as its name() value. Each constant in the enum type returns a distinct toString() value.
Will not necessarily work correctly for other cases.

Author:
Vaadin Ltd
See Also: