Class CharacterConversion

All Implemented Interfaces:
Conversion<String,Character>

public class CharacterConversion extends ObjectConversion<Character>
Converts Strings to Characters and vice versa
  • Constructor Details

    • CharacterConversion

      public CharacterConversion()
      Creates a Conversion from String to Character with default values to return when the input is null. This default constructor assumes the output of a conversion should be null when input is null
    • CharacterConversion

      public CharacterConversion(Character valueIfStringIsNull, String valueIfObjectIsNull)
      Creates a Conversion from String to Character with default values to return when the input is null.
      Parameters:
      valueIfStringIsNull - default Character value to be returned when the input String is null. Used when ObjectConversion.execute(String) is invoked.
      valueIfObjectIsNull - default String value to be returned when a Character input is null. Used when revert(Character) is invoked.
  • Method Details

    • fromString

      protected Character fromString(String input)
      Converts a String to a Character.
      Specified by:
      fromString in class ObjectConversion<Character>
      Parameters:
      input - The String to be converted to T
      Returns:
      an instance of T, converted from the String input.
      Throws:
      IllegalArgumentException - if the input String length is not equal to 1, then an IllegalArgumentException is thrown.