Class CharacterConverter

java.lang.Object
jodd.typeconverter.impl.CharacterConverter
All Implemented Interfaces:
TypeConverter<Character>

public class CharacterConverter extends Object implements TypeConverter<Character>
Converts given object to Character. Conversion rules:
  • null value is returned as null
  • object of destination type is simply casted
  • Number is converted to char value
  • finally, toString() value of length 1 is converted to char
  • if string is longer, and made of digits, try to convert it to int first
  • Constructor Details

    • CharacterConverter

      public CharacterConverter()
  • Method Details

    • convert

      public Character convert(Object value)
      Description copied from interface: TypeConverter
      Converts object received as parameter into object of another class. For example, an Integer converter tries to convert given objects into target Integer object. Converters should try all reasonable ways of conversion into target object, depending on target type.
      Specified by:
      convert in interface TypeConverter<Character>
      Parameters:
      value - object to convert from
      Returns:
      resulting object converted to target type