Class Converters.PassThruConverter<S,T>

java.lang.Object
org.apache.ofbiz.base.conversion.Converters.PassThruConverter<S,T>
All Implemented Interfaces:
Converter<S,T>
Enclosing class:
Converters

protected static class Converters.PassThruConverter<S,T> extends Object implements Converter<S,T>
Pass thru converter used when the source and target java object types are the same. The convert method returns the source object.
  • Method Details

    • canConvert

      public boolean canConvert(Class<?> sourceClass, Class<?> targetClass)
      Description copied from interface: Converter
      Returns true if this object can convert sourceClass to targetClass.

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

      Specified by:
      canConvert in interface Converter<S,T>
      Parameters:
      sourceClass - The source Class
      targetClass - The target Class
      Returns:
      true if this object can convert sourceClass to targetClass.
    • convert

      public T convert(S obj) throws ConversionException
      Description copied from interface: Converter
      Converts obj to T.
      Specified by:
      convert in interface Converter<S,T>
      Parameters:
      obj - The source Object to convert
      Returns:
      The converted Object
      Throws:
      ConversionException
    • convert

      public T convert(Class<? extends T> targetClass, S obj) throws ConversionException
      Description copied from interface: Converter
      Converts obj to T.
      Specified by:
      convert in interface Converter<S,T>
      Parameters:
      targetClass - The Class to convert to
      obj - The source Object to convert
      Returns:
      The converted Object
      Throws:
      ConversionException
    • getSourceClass

      public Class<?> getSourceClass()
      Description copied from interface: Converter
      Returns the source Class for this converter.
      Specified by:
      getSourceClass in interface Converter<S,T>
      Returns:
      The source Class for this converter
    • getTargetClass

      public Class<?> getTargetClass()
      Description copied from interface: Converter
      Returns the target Class for this converter.
      Specified by:
      getTargetClass in interface Converter<S,T>
      Returns:
      The target Class for this converter