Converter
Date: 2016-06-25

org.osgi.service.blueprint.container

## Interface Converter

-     @ConsumerType
      public interface Converter

  Type converter to convert an object to a target type.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `canConvert(java.lang.Object sourceObject, ReifiedType targetType)` Return if this converter is able to convert the specified object to the specified type.
    `java.lang.Object` | `convert(java.lang.Object sourceObject, ReifiedType targetType)` Convert the specified object to an instance of the specified type.

- - ### Method Detail

    - #### canConvert

          boolean canConvert(java.lang.Object sourceObject,
                           ReifiedType targetType)

      Return if this converter is able to convert the specified object to the specified type.
      Parameters:
        `sourceObject` - The source object `s` to convert.
        `targetType` - The target type `T`.
      Returns:
        `true` if the conversion is possible, `false` otherwise.

    - #### convert

          java.lang.Object convert(java.lang.Object sourceObject,
                                 ReifiedType targetType)
                                   throws java.lang.Exception

      Convert the specified object to an instance of the specified type.
      Parameters:
        `sourceObject` - The source object `s` to convert.
        `targetType` - The target type `T`.
      Returns:
        An instance with a type that is assignable from targetType's raw class
      Throws:
        `java.lang.Exception` - If the conversion cannot succeed. This exception should not be thrown when the `canConvert` method has returned `true`.