Class TypeStringConverterFactory.TypeStringConverter

java.lang.Object
org.joda.convert.TypeStringConverterFactory.TypeStringConverter
All Implemented Interfaces:
FromStringConverter<Type>, StringConverter<Type>, ToStringConverter<Type>, TypedFromStringConverter<Type>, TypedStringConverter<Type>
Enclosing class:
TypeStringConverterFactory

static final class TypeStringConverterFactory.TypeStringConverter extends Object implements TypedStringConverter<Type>
  • Field Details

    • effectiveType

      private final Class<?> effectiveType
  • Constructor Details

    • TypeStringConverter

      TypeStringConverter(Class<?> effectiveType)
  • Method Details

    • convertToString

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

      public Type convertFromString(Class<? extends Type> cls, String str)
      Description copied from interface: FromStringConverter
      Converts the specified object from a String.
      Specified by:
      convertFromString in interface FromStringConverter<Type>
      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<Type>
      Specified by:
      getEffectiveType in interface TypedStringConverter<Type>
      Returns:
      the effective type