Class Converter<S,​T>

  • Type Parameters:
    S - the Converter's source type
    T - the Converter's target type

    public abstract class Converter<S,​T>
    extends java.lang.Object
    Converter is responsible for converting a value from one type to another.

    The conversion methods can throw RuntimeExceptions in response to a problem in conversion. For example, a String to Integer converter might throw a NumberFormatException if the String can't be parsed properly into an Integer.

    • Constructor Summary

      Constructors 
      Constructor Description
      Converter()  
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      abstract T convertForward​(S value)
      Converts a value from the source type to the target type.
      abstract S convertReverse​(T value)
      Converts a value from the target type to the source type.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Converter

        public Converter()
    • Method Detail

      • convertForward

        public abstract T convertForward​(S value)
        Converts a value from the source type to the target type. Can throw a RuntimeException to indicate a problem with the conversion.
        Parameters:
        value - the source value to convert
        Returns:
        the value, converted to the target type
      • convertReverse

        public abstract S convertReverse​(T value)
        Converts a value from the target type to the source type. Can throw a RuntimeException to indicate a problem with the conversion.
        Parameters:
        value - the target value to convert
        Returns:
        the value, converted to the source type