Interface Conversion

All Known Implementing Classes:
DefaultConversion

public interface Conversion
Conversion from one type to another.
  • Method Summary

    Modifier and Type
    Method
    Description
    <SOURCE_TYPE, TARGET_TYPE>
    boolean
    canConvert(Class<SOURCE_TYPE> sourceTypeClass, Class<TARGET_TYPE> targetTypeClass)
    Returns whether the given source type can be converted to the given target type.
    <TARGET_TYPE>
    boolean
    canConvert(Object object, Class<TARGET_TYPE> targetTypeClass)
    Returns whether the given object can be converted to the given target type.
    <SOURCE_TYPE, TARGET_TYPE>
    List<TARGET_TYPE>
    convert(Iterable<SOURCE_TYPE> objectIterable, Class<SOURCE_TYPE> sourceTypeClass, Class<TARGET_TYPE> targetTypeClass)
    Converts each object from a set to the target type.
    <SOURCE_TYPE, TARGET_TYPE>
    List<TARGET_TYPE>
    convert(Iterable<SOURCE_TYPE> objectIterable, Class<TARGET_TYPE> targetTypeClass)
    Converts each object from an iterable to the target type.
    <SOURCE_TYPE, TARGET_TYPE>
    List<TARGET_TYPE>
    convert(List<SOURCE_TYPE> objectList, Class<SOURCE_TYPE> sourceTypeClass, Class<TARGET_TYPE> targetTypeClass)
    Converts each object from a list to the target type.
    <SOURCE_TYPE, TARGET_TYPE>
    List<TARGET_TYPE>
    convert(List<SOURCE_TYPE> objectList, Class<TARGET_TYPE> targetTypeClass)
    Converts each object from a list to the target type.
    <SOURCE_TYPE, TARGET_TYPE>
    Set<TARGET_TYPE>
    convert(Set<SOURCE_TYPE> objectList, Class<SOURCE_TYPE> sourceTypeClass, Class<TARGET_TYPE> targetTypeClass)
    Converts each object from a set to the target type.
    <SOURCE_TYPE, TARGET_TYPE>
    Set<TARGET_TYPE>
    convert(Set<SOURCE_TYPE> objectList, Class<TARGET_TYPE> targetTypeClass)
    Converts each object from a set to the target type.
    <SOURCE_TYPE, TARGET_TYPE>
    TARGET_TYPE
    convert(SOURCE_TYPE object, Class<SOURCE_TYPE> sourceTypeClass, Class<TARGET_TYPE> targetTypeClass)
    Converts an object to the target type.
    <SOURCE_TYPE, TARGET_TYPE>
    TARGET_TYPE
    convert(SOURCE_TYPE object, Class<TARGET_TYPE> targetTypeClass)
    Converts an object to the target type.
  • Method Details

    • canConvert

      <SOURCE_TYPE, TARGET_TYPE> boolean canConvert(Class<SOURCE_TYPE> sourceTypeClass, Class<TARGET_TYPE> targetTypeClass)
      Returns whether the given source type can be converted to the given target type.
      Type Parameters:
      SOURCE_TYPE - The source generic type
      TARGET_TYPE - The target generic type
      Parameters:
      sourceTypeClass - The source type class
      targetTypeClass - The target type class
      Returns:
      true if conversion is possible, otherwise, false
    • canConvert

      <TARGET_TYPE> boolean canConvert(Object object, Class<TARGET_TYPE> targetTypeClass)
      Returns whether the given object can be converted to the given target type.
      Type Parameters:
      TARGET_TYPE - The target generic type
      Parameters:
      object - The source object
      targetTypeClass - The target type class
      Returns:
      true if conversion is possible, otherwise, false
    • convert

      <SOURCE_TYPE, TARGET_TYPE> TARGET_TYPE convert(SOURCE_TYPE object, Class<TARGET_TYPE> targetTypeClass)
      Converts an object to the target type.
      Type Parameters:
      SOURCE_TYPE - The source generic type
      TARGET_TYPE - The target generic type
      Parameters:
      object - The object to convert
      targetTypeClass - The target type class
      Returns:
      converted object
      Throws:
      ConversionException.ConverterDoesNotExist - If the needed converter does not exist
    • convert

      <SOURCE_TYPE, TARGET_TYPE> TARGET_TYPE convert(SOURCE_TYPE object, Class<SOURCE_TYPE> sourceTypeClass, Class<TARGET_TYPE> targetTypeClass)
      Converts an object to the target type.
      Type Parameters:
      SOURCE_TYPE - The source generic type
      TARGET_TYPE - The target generic type
      Parameters:
      object - The object to convert
      sourceTypeClass - The source type class
      targetTypeClass - The target type class
      Returns:
      converted object
      Throws:
      ConversionException.ConverterDoesNotExist - If the needed converter does not exist
    • convert

      <SOURCE_TYPE, TARGET_TYPE> List<TARGET_TYPE> convert(Iterable<SOURCE_TYPE> objectIterable, Class<TARGET_TYPE> targetTypeClass)
      Converts each object from an iterable to the target type.
      Type Parameters:
      SOURCE_TYPE - The source generic type
      TARGET_TYPE - The target generic type
      Parameters:
      objectIterable - The iterable of objects to convert
      targetTypeClass - The target type class
      Returns:
      converted collection of objects
      Throws:
      ConversionException.ConverterDoesNotExist - If the needed converter does not exist
    • convert

      <SOURCE_TYPE, TARGET_TYPE> List<TARGET_TYPE> convert(Iterable<SOURCE_TYPE> objectIterable, Class<SOURCE_TYPE> sourceTypeClass, Class<TARGET_TYPE> targetTypeClass)
      Converts each object from a set to the target type.
      Type Parameters:
      SOURCE_TYPE - The source generic type
      TARGET_TYPE - The target generic type
      Parameters:
      objectIterable - The iterable of objects to convert
      sourceTypeClass - The source type class
      targetTypeClass - The target type class
      Returns:
      converted collection of objects
      Throws:
      ConversionException.ConverterDoesNotExist - If the needed converter does not exist
    • convert

      <SOURCE_TYPE, TARGET_TYPE> List<TARGET_TYPE> convert(List<SOURCE_TYPE> objectList, Class<TARGET_TYPE> targetTypeClass)
      Converts each object from a list to the target type.
      Type Parameters:
      SOURCE_TYPE - The source generic type
      TARGET_TYPE - The target generic type
      Parameters:
      objectList - The list of objects to convert
      targetTypeClass - The target type class
      Returns:
      converted collection of objects
      Throws:
      ConversionException.ConverterDoesNotExist - If the needed converter does not exist
    • convert

      <SOURCE_TYPE, TARGET_TYPE> List<TARGET_TYPE> convert(List<SOURCE_TYPE> objectList, Class<SOURCE_TYPE> sourceTypeClass, Class<TARGET_TYPE> targetTypeClass)
      Converts each object from a list to the target type.
      Type Parameters:
      SOURCE_TYPE - The source generic type
      TARGET_TYPE - The target generic type
      Parameters:
      objectList - The list of objects to convert
      sourceTypeClass - The source type class
      targetTypeClass - The target type class
      Returns:
      converted collection of objects
      Throws:
      ConversionException.ConverterDoesNotExist - If the needed converter does not exist
    • convert

      <SOURCE_TYPE, TARGET_TYPE> Set<TARGET_TYPE> convert(Set<SOURCE_TYPE> objectList, Class<TARGET_TYPE> targetTypeClass)
      Converts each object from a set to the target type.
      Type Parameters:
      SOURCE_TYPE - The source generic type
      TARGET_TYPE - The target generic type
      Parameters:
      objectList - The set of objects to convert
      targetTypeClass - The target type class
      Returns:
      converted collection of objects
      Throws:
      ConversionException.ConverterDoesNotExist - If the needed converter does not exist
    • convert

      <SOURCE_TYPE, TARGET_TYPE> Set<TARGET_TYPE> convert(Set<SOURCE_TYPE> objectList, Class<SOURCE_TYPE> sourceTypeClass, Class<TARGET_TYPE> targetTypeClass)
      Converts each object from a set to the target type.
      Type Parameters:
      SOURCE_TYPE - The source generic type
      TARGET_TYPE - The target generic type
      Parameters:
      objectList - The set of objects to convert
      sourceTypeClass - The source type class
      targetTypeClass - The target type class
      Returns:
      converted collection of objects
      Throws:
      ConversionException.ConverterDoesNotExist - If the needed converter does not exist