Class EnumStringConverterFactory.EnumStringConverter

java.lang.Object
org.joda.convert.EnumStringConverterFactory.EnumStringConverter
All Implemented Interfaces:
FromStringConverter<Enum<?>>, StringConverter<Enum<?>>, ToStringConverter<Enum<?>>, TypedFromStringConverter<Enum<?>>, TypedStringConverter<Enum<?>>
Enclosing class:
EnumStringConverterFactory

static final class EnumStringConverterFactory.EnumStringConverter extends Object implements TypedStringConverter<Enum<?>>
  • Field Details

    • effectiveType

      private final Class<?> effectiveType
  • Constructor Details

    • EnumStringConverter

      EnumStringConverter(Class<?> effectiveType)
  • Method Details

    • convertToString

      public String convertToString(Enum<?> en)
      Description copied from interface: ToStringConverter
      Converts the specified object to a String.
      Specified by:
      convertToString in interface ToStringConverter<Enum<?>>
      Parameters:
      en - the object to convert, not null
      Returns:
      the converted string, may be null but generally not
    • convertFromString

      public Enum<?> convertFromString(Class<? extends Enum<?>> cls, String str)
      Description copied from interface: FromStringConverter
      Converts the specified object from a String.
      Specified by:
      convertFromString in interface FromStringConverter<Enum<?>>
      Parameters:
      cls - the class to convert to, not null
      str - the string to convert, not null
      Returns:
      the converted object, may be null but generally not
    • getEffectiveType

      public Class<?> getEffectiveType()
      Description copied from interface: TypedStringConverter
      Gets the effective type that the converter works on.

      For example, if a class declares the FromString and ToString then the effective type of the converter is that class. If a subclass is queried for a converter, then the effective type is that of the superclass.

      Specified by:
      getEffectiveType in interface TypedFromStringConverter<Enum<?>>
      Specified by:
      getEffectiveType in interface TypedStringConverter<Enum<?>>
      Returns:
      the effective type