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
Constructors -
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 (MapforHashMapetc.).Returns all types that are allowed pagination return types.Returns all unwrapper functions that transform the custom collections into Java-native ones.static booleanisCollection(Class<?> type) Returns whether the given type is considered aCollectiontype.static booleanReturns whether the given type is considered aMaptype.static booleanisMapBaseType(Class<?> type) Returns whether the given type is a map base type.static voidregisterConvertersIn(org.springframework.core.convert.converter.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 (MapforHashMapetc.).- 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 aMaptype.- Parameters:
type- must not be null.- Returns:
- will never be null.
-
isCollection
Returns whether the given type is considered aCollectiontype.- 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
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 givenConverterRegistry.- Parameters:
registry- must not be null.
-