org.springframework.data.util

## Class KotlinReflectionUtils

- java.lang.Object
- - org.springframework.data.util.KotlinReflectionUtils

    public final class KotlinReflectionUtils
    extends Object

Reflection utility methods specific to Kotlin reflection. Requires Kotlin classes to be present to avoid linkage errors.

Since:
  2.3
Author:
  Mark Paluch, Christoph Strobl
See Also:
  `KotlinDetector.isKotlinReflectPresent()`

### Method Summary

All Methods Static Methods Concrete Methods
`static kotlin.reflect.KFunction<?>` `findKotlinFunction(Method method)` Returns a `KFunction` instance corresponding to the given Java `Method` instance, or `null` if this method cannot be represented by a Kotlin function.
`static Class<?>` `getReturnType(Method method)` Returns the `return type` of a Kotlin `Method`.
`static boolean` `isSupportedKotlinClass(Class<?> type)` Return true if the specified class is a supported Kotlin class.
`static boolean` `isSuspend(Method method)` Returns whether the `Method` is declared as suspend (Kotlin Coroutine).

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

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

### Method Detail

#### isSupportedKotlinClass

    public static boolean isSupportedKotlinClass(Class<?> type)

Return true if the specified class is a supported Kotlin class. Currently supported are only regular Kotlin classes. Other class types (synthetic, SAM, lambdas) are not supported via reflection.

Returns:
  true if `type` is a supported Kotlin class.

#### findKotlinFunction

    @Nullable
    public static kotlin.reflect.KFunction<?> findKotlinFunction(Method method)

Returns a `KFunction` instance corresponding to the given Java `Method` instance, or `null` if this method cannot be represented by a Kotlin function.

Parameters:
  `method` - the method to look up.
Returns:
  the `KFunction` or `null` if the method cannot be looked up.

#### isSuspend

    public static boolean isSuspend(Method method)

Returns whether the `Method` is declared as suspend (Kotlin Coroutine).

Parameters:
  `method` - the method to inspect.
Returns:
  true if the method is declared as suspend.
See Also:
  `KFunction.isSuspend()`

#### getReturnType

    public static Class<?> getReturnType(Method method)

Returns the `return type` of a Kotlin `Method`. Supports regular and suspended methods.

Parameters:
  `method` - the method to inspect, typically any synthetic JVM `Method`.
Returns:
  return type of the method.