Package org.springframework.data.util
Class CustomCollections
java.lang.Object
org.springframework.data.util.CustomCollections
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns all custom collection and map types.static Class<?>
getMapBaseType
(Class<?> type) Returns the map base type for the given type, i.e. the one that's considered the logical map interface (Map
forHashMap
etc.).Returns all types that are allowed pagination return types.Returns all unwrapper functions that transform the custom collections into Java-native ones.static boolean
isCollection
(Class<?> type) Returns whether the given type is considered aCollection
type.static boolean
Returns whether the given type is considered aMap
type.static boolean
isMapBaseType
(Class<?> type) Returns whether the given type is a map base type.static void
registerConvertersIn
(ConverterRegistry registry) Registers all converters to transform Java-native collections into custom ones and back in the givenConverterRegistry
.
-
Constructor Details
-
CustomCollections
public CustomCollections()
-
-
Method Details
-
getCustomTypes
Returns all custom collection and map types.- Returns:
- will never be null.
-
getPaginationReturnTypes
Returns all types that are allowed pagination return types.- Returns:
- will never be null.
-
isMapBaseType
Returns whether the given type is a map base type.- Parameters:
type
- must not be null.- Returns:
- will never be null.
-
getMapBaseType
Returns the map base type for the given type, i.e. the one that's considered the logical map interface (Map
forHashMap
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
Returns whether the given type is considered aMap
type.- Parameters:
type
- must not be null.- Returns:
- will never be null.
-
isCollection
Returns whether the given type is considered aCollection
type.- Parameters:
type
- must not be null.- Returns:
- will never be null.
-
getUnwrappers
Returns all unwrapper functions that transform the custom collections into Java-native ones.- Returns:
- will never be null.
-
registerConvertersIn
Registers all converters to transform Java-native collections into custom ones and back in the givenConverterRegistry
.- Parameters:
registry
- must not be null.
-