Class QueryExecutionConverters

java.lang.Object
org.springframework.data.repository.util.QueryExecutionConverters

public abstract class QueryExecutionConverters extends Object
Converters to potentially wrap the execution of a repository method into a variety of wrapper types potentially being available on the classpath. Currently supported:
  • java.util.concurrent.Future
  • java.util.concurrent.CompletableFuture
  • org.springframework.util.concurrent.ListenableFuture<
  • javaslang.collection.Seq, javaslang.collection.Map, javaslang.collection.Set - as of 1.13
  • io.vavr.collection.Seq, io.vavr.collection.Map, io.vavr.collection.Set - as of 2.0
  • Reactive wrappers supported by ReactiveWrappers - as of 2.0
Since:
1.8
Author:
Oliver Gierke, Mark Paluch, Christoph Strobl, Maciek Opała, Jens Schauder
See Also:
  • Method Details

    • supports

      public static boolean supports(Class<?> type)
      Returns whether the given type is a supported wrapper type.
      Parameters:
      type - must not be null.
      Returns:
    • supportsUnwrapping

      public static boolean supportsUnwrapping(Class<?> type)
      Returns whether the given wrapper type supports unwrapping.
      Parameters:
      type - must not be null.
      Returns:
    • isSingleValue

      public static boolean isSingleValue(Class<?> type)
    • getAllowedPageableTypes

      public static Set<Class<?>> getAllowedPageableTypes()
      Returns the types that are supported on paginating query methods. Will include custom collection types of e.g. Vavr.
      Returns:
    • registerConvertersIn

      public static void registerConvertersIn(ConfigurableConversionService conversionService)
      Registers converters for wrapper types found on the classpath.
      Parameters:
      conversionService - must not be null.
    • unwrap

      @Nullable public static Object unwrap(@Nullable Object source)
      Unwraps the given source value in case it's one of the currently supported wrapper types detected at runtime.
      Parameters:
      source - can be null.
      Returns:
    • unwrapWrapperTypes

      public static TypeInformation<?> unwrapWrapperTypes(TypeInformation<?> type, TypeInformation<?> reference)
      Recursively unwraps well known wrapper types from the given TypeInformation but aborts at the given reference type.
      Parameters:
      type - must not be null.
      reference - must not be null.
      Returns:
      will never be null.
    • 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.
    • getExecutionAdapter

      @Nullable public static QueryExecutionConverters.ExecutionAdapter getExecutionAdapter(Class<?> returnType)
      Returns the QueryExecutionConverters.ExecutionAdapter to be used for the given return type.
      Parameters:
      returnType - must not be null.
      Returns:
      can be null.