Interface Converter


  • public interface Converter
    Converts values of one type into another.
    Since:
    2.4
    Author:
    Justin Deoliveira, The Open Planning Project
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      <T> T convert​(Object source, Class<T> target)
      Converts an object to an object of another type.
    • Method Detail

      • convert

        <T> T convert​(Object source,
                      Class<T> target)
               throws Exception
        Converts an object to an object of another type.

        If the conversion supplied is not supported, this method can either throw an exception or return null.

        Parameters:
        source - The original object, never null
        target - The type of the converted object.
        Returns:
        An instance of target, or null if the conversion could not take place.
        Throws:
        Exception - If the conversion can not take place.