Interface Converter<S,​T>

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean canConvert​(java.lang.Class<?> sourceClass, java.lang.Class<?> targetClass)
      Returns true if this object can convert sourceClass to targetClass.
      T convert​(java.lang.Class<? extends T> targetClass, S obj)
      Converts obj to T.
      T convert​(S obj)
      Converts obj to T.
      java.lang.Class<?> getSourceClass()
      Returns the source Class for this converter.
      java.lang.Class<?> getTargetClass()
      Returns the target Class for this converter.
    • Method Detail

      • canConvert

        boolean canConvert​(java.lang.Class<?> sourceClass,
                           java.lang.Class<?> targetClass)
        Returns true if this object can convert sourceClass to targetClass.

        Implementations can accomodate class hierarchy ranges by converting super classes or interfaces.

        Parameters:
        sourceClass - The source Class
        targetClass - The target Class
        Returns:
        true if this object can convert sourceClass to targetClass.
      • convert

        T convert​(java.lang.Class<? extends T> targetClass,
                  S obj)
           throws ConversionException
        Converts obj to T.
        Parameters:
        targetClass - The Class to convert to
        obj - The source Object to convert
        Returns:
        The converted Object
        Throws:
        ConversionException
      • getSourceClass

        java.lang.Class<?> getSourceClass()
        Returns the source Class for this converter.
        Returns:
        The source Class for this converter
      • getTargetClass

        java.lang.Class<?> getTargetClass()
        Returns the target Class for this converter.
        Returns:
        The target Class for this converter