Class CustomCollections

java.lang.Object
org.springframework.data.util.CustomCollections

public class CustomCollections extends Object
Central API to expose information about custom collections present for Spring Data. Exposes custom collection and map types and registers converters to convert them from and to Java-native collections.
Since:
2.7
Author:
Oliver Drotbohm
  • Constructor Details

    • CustomCollections

      public CustomCollections()
  • Method Details

    • getCustomTypes

      public static Set<Class<?>> getCustomTypes()
      Returns all custom collection and map types.
      Returns:
      will never be null.
    • getPaginationReturnTypes

      public static Set<Class<?>> getPaginationReturnTypes()
      Returns all types that are allowed pagination return types.
      Returns:
      will never be null.
    • isMapBaseType

      public static boolean isMapBaseType(Class<?> type)
      Returns whether the given type is a map base type.
      Parameters:
      type - must not be null.
      Returns:
      will never be null.
    • getMapBaseType

      public static Class<?> getMapBaseType(Class<?> type) throws IllegalArgumentException
      Returns the map base type for the given type, i.e. the one that's considered the logical map interface (Map for HashMap etc.).
      Parameters:
      type - must not be null.
      Returns:
      will never be null.
      Throws:
      IllegalArgumentException - in case we do not find a map base type for the given one.
    • isMap

      public static boolean isMap(Class<?> type)
      Returns whether the given type is considered a Map type.
      Parameters:
      type - must not be null.
      Returns:
      will never be null.
    • isCollection

      public static boolean isCollection(Class<?> type)
      Returns whether the given type is considered a Collection type.
      Parameters:
      type - must not be null.
      Returns:
      will never be null.
    • getUnwrappers

      public static Set<Function<Object,Object>> getUnwrappers()
      Returns all unwrapper functions that transform the custom collections into Java-native ones.
      Returns:
      will never be null.
    • registerConvertersIn

      public static void registerConvertersIn(org.springframework.core.convert.converter.ConverterRegistry registry)
      Registers all converters to transform Java-native collections into custom ones and back in the given ConverterRegistry.
      Parameters:
      registry - must not be null.