org.springframework.data.repository.util

## Class ReactiveWrapperConverters

- java.lang.Object
- - org.springframework.data.repository.util.ReactiveWrapperConverters

    public abstract class ReactiveWrapperConverters
    extends Object

Conversion support for reactive wrapper types. This class is a reactive extension to `QueryExecutionConverters`.

This class discovers reactive wrapper availability and their conversion support based on the class path. Reactive wrapper types might be supported/on the class path but conversion may require additional dependencies.

Note: As of Spring Data 2.4, support for RxJava 1.x is deprecated in favor of RxJava 2 and 3.

Since:
  2.0
Author:
  Mark Paluch, Oliver Gierke, Christoph Strobl
See Also:
  `ReactiveWrappers`, `ReactiveAdapterRegistry`

### Method Summary

All Methods Static Methods Concrete Methods
`static boolean` `canConvert(Class<?> sourceType, Class<?> targetType)` Return true if objects of `sourceType` can be converted to the `targetType`.
`static <T> T` `map(Object reactiveObject, Function<Object,Object> converter)` Maps elements of a reactive element stream to other elements.
`static boolean` `supports(Class<?> type)` Returns whether the given type is supported for wrapper type conversion.
`static <T> T` `toWrapper(Object reactiveObject, Class<? extends T> targetWrapperType)` Casts or adopts the given wrapper type to a target wrapper type.
`static TypeInformation<?>` `unwrapWrapperTypes(TypeInformation<?> type)` Recursively unwraps well known wrapper types from the given `TypeInformation`.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### supports

    public static boolean supports(Class<?> type)

Returns whether the given type is supported for wrapper type conversion.

NOTE: A reactive wrapper type might be supported in general by `ReactiveWrappers.supports(Class)` but not necessarily for conversion using this method.

Parameters:
  `type` - must not be null.
Returns:
  true if the `type` is a supported reactive wrapper type.

#### unwrapWrapperTypes

    public static TypeInformation<?> unwrapWrapperTypes(TypeInformation<?> type)

Recursively unwraps well known wrapper types from the given `TypeInformation`.

Parameters:
  `type` - must not be null.
Returns:
  will never be null.
Since:
  2.4

#### toWrapper

    @Nullable
    public static <T> T toWrapper(Object reactiveObject,
                                            Class<? extends T> targetWrapperType)

Casts or adopts the given wrapper type to a target wrapper type.

Parameters:
  `reactiveObject` - the stream, must not be null.
  `targetWrapperType` - must not be null.
Returns:

#### map

    public static <T> T map(Object reactiveObject,
                            Function<Object,Object> converter)

Maps elements of a reactive element stream to other elements.

Parameters:
  `reactiveObject` - must not be null.
  `converter` - must not be null.
Returns:

#### canConvert

    public static boolean canConvert(Class<?> sourceType,
                                     Class<?> targetType)

Return true if objects of `sourceType` can be converted to the `targetType`.

Parameters:
  `sourceType` - must not be null.
  `targetType` - must not be null.
Returns:
  true if a conversion can be performed.