Package io.axoniq.dataprotection.serialization

## Interface Converter

- All Known Implementing Classes:
    `ChainingConverter`

      public interface Converter

  Interface describing a mechanism that can convert data from one to another type.
  Author:
    Rene de Waele

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `canConvert​(Class<?> sourceType, Class<?> targetType)` | Indicates whether this converter is capable of converting the given `sourceType` to the `targetType`.
    `default <T> SerializedObject<T>` | `convert​(SerializedObject<?> original, Class<T> targetType)` | Converts the data format of the given `original` IntermediateRepresentation to the target data type.
    `<T> T` | `convert​(Object original, Class<?> sourceType, Class<T> targetType)` | Converts the given object into another using the source type to find the conversion path.
    `default <T> T` | `convert​(Object original, Class<T> targetType)` | Converts the given object into another.

- - ### Method Detail

    - #### canConvert

          boolean canConvert​(Class<?> sourceType,
                             Class<?> targetType)

      Indicates whether this converter is capable of converting the given `sourceType` to the `targetType`.
      Parameters:
        `sourceType` - The type of data to convert from
        `targetType` - The type of data to convert to
      Returns:
        `true` if conversion is possible, `false` otherwise

    - #### convert

          default <T> T convert​(Object original,
                                Class<T> targetType)

      Converts the given object into another.
      Type Parameters:
        `T` - the target data type
      Parameters:
        `original` - the value to convert
        `targetType` - The type of data to convert to
      Returns:
        the converted value

    - #### convert

          <T> T convert​(Object original,
                        Class<?> sourceType,
                        Class<T> targetType)

      Converts the given object into another using the source type to find the conversion path.
      Type Parameters:
        `T` - the target data type
      Parameters:
        `original` - the value to convert
        `sourceType` - the type of data to convert
        `targetType` - The type of data to convert to
      Returns:
        the converted value

    - #### convert

          default <T> SerializedObject<T> convert​(SerializedObject<?> original,
                                                  Class<T> targetType)

      Converts the data format of the given `original` IntermediateRepresentation to the target data type.
      Type Parameters:
        `T` - the target data type
      Parameters:
        `original` - The source to convert
        `targetType` - The type of data to convert to
      Returns:
        the converted representation