Class EnumEditor

All Implemented Interfaces:
PropertyEditor

public class EnumEditor extends AbstractPropertyEditor
A PropertyEditor which converts a String into an Enum and vice versa.
  • Field Details

    • ORDINAL

      private static final Pattern ORDINAL
    • enumType

      private final Class enumType
    • enums

      private final Set<Enum<?>> enums
  • Constructor Details

    • EnumEditor

      public EnumEditor(Class enumType)
      Creates a new EnumEditor instance
      Parameters:
      enumType - The type of Enum
  • Method Details

    • toText

      protected String toText(Object value)
      Returns a String representation of the given value
      Specified by:
      toText in class AbstractPropertyEditor
      Parameters:
      value - The value
      Returns:
      A String representation of the value
    • toValue

      protected Object toValue(String text)
      Returns an instance from a String representation of an object
      Specified by:
      toValue in class AbstractPropertyEditor
      Parameters:
      text - The String representation to convert
      Returns:
      A instance of an object