Package org.springframework.data.convert
Class SimpleTypeInformationMapper
java.lang.Object
org.springframework.data.convert.SimpleTypeInformationMapper
- All Implemented Interfaces:
Aware
,BeanClassLoaderAware
,TypeInformationMapper
public class SimpleTypeInformationMapper
extends Object
implements TypeInformationMapper, BeanClassLoaderAware
Basic
TypeInformationMapper
implementation that interprets the alias handles as fully qualified class name
and tries to load a class with the given name to build TypeInformation
. Returns the fully qualified class
name for alias creation.- Author:
- Oliver Gierke, Mark Paluch
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateAliasFor
(TypeInformation<?> type) Turn the given type information into the String representation that shall be stored.resolveTypeFrom
(Alias alias) Returns theTypeInformation
that shall be used when the givenString
value is found as type hint.void
setBeanClassLoader
(ClassLoader classLoader)
-
Constructor Details
-
SimpleTypeInformationMapper
public SimpleTypeInformationMapper()
-
-
Method Details
-
resolveTypeFrom
Returns theTypeInformation
that shall be used when the givenString
value is found as type hint. The implementation will simply interpret the given value as fully-qualified class name and try to load the class. Will return null in case the givenString
is empty.- Specified by:
resolveTypeFrom
in interfaceTypeInformationMapper
- Parameters:
alias
- the type to load, must not be null.- Returns:
- the type to be used for the given
String
representation or null if nothing found or the class cannot be loaded.
-
createAliasFor
Turn the given type information into the String representation that shall be stored. Default implementation simply returns the fully-qualified class name.- Specified by:
createAliasFor
in interfaceTypeInformationMapper
- Parameters:
type
- must not be null.- Returns:
- the String representation to be stored or null if no type information shall be stored.
-
setBeanClassLoader
- Specified by:
setBeanClassLoader
in interfaceBeanClassLoaderAware
-