Package org.springframework.aot.hint
Class ReflectionHints
java.lang.Object
org.springframework.aot.hint.ReflectionHints
Gather the need for reflection at runtime.
- Since:
- 6.0
- Author:
- Stephane Nicoll, Phillip Webb, Andy Wilkinson
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetTypeHint
(Class<?> type) Return the reflection hints for the specified type.getTypeHint
(TypeReference type) Return the reflection hints for the type defined by the specifiedTypeReference
.registerConstructor
(Constructor<?> constructor, ExecutableMode mode) Register the need for reflection on the specifiedConstructor
, using the specifiedExecutableMode
.registerField
(Field field) Register the need for reflection on the specifiedField
.registerMethod
(Method method, ExecutableMode mode) Register the need for reflection on the specifiedMethod
, using the specifiedExecutableMode
.registerType
(Class<?> type, Consumer<TypeHint.Builder> typeHint) Register or customize reflection hints for the specified type.registerType
(Class<?> type, MemberCategory... memberCategories) Register or customize reflection hints for the specified type using the specifiedMemberCategories
.registerType
(TypeReference type, Consumer<TypeHint.Builder> typeHint) Register or customize reflection hints for the type defined by the specifiedTypeReference
.registerType
(TypeReference type, MemberCategory... memberCategories) Register or customize reflection hints for the specified type using the specifiedMemberCategories
.registerTypeIfPresent
(ClassLoader classLoader, String typeName, Consumer<TypeHint.Builder> typeHint) Register or customize reflection hints for the specified type if it is available using the specifiedClassLoader
.registerTypeIfPresent
(ClassLoader classLoader, String typeName, MemberCategory... memberCategories) Register or customize reflection hints for the specified type if it is available using the specifiedClassLoader
.registerTypes
(Iterable<TypeReference> types, Consumer<TypeHint.Builder> typeHint) Register or customize reflection hints for the types defined by the specified list oftype references
.Return the types that require reflection.
-
Constructor Details
-
ReflectionHints
public ReflectionHints()
-
-
Method Details
-
typeHints
Return the types that require reflection.- Returns:
- the type hints
-
getTypeHint
Return the reflection hints for the type defined by the specifiedTypeReference
.- Parameters:
type
- the type to inspect- Returns:
- the reflection hints for this type, or
null
-
getTypeHint
Return the reflection hints for the specified type.- Parameters:
type
- the type to inspect- Returns:
- the reflection hints for this type, or
null
-
registerType
Register or customize reflection hints for the type defined by the specifiedTypeReference
.- Parameters:
type
- the type to customizetypeHint
- a builder to further customize hints for that type- Returns:
this
, to facilitate method chaining- See Also:
-
registerType
Register or customize reflection hints for the specified type using the specifiedMemberCategories
.- Parameters:
type
- the type to customizememberCategories
- the member categories to apply- Returns:
this
, to facilitate method chaining
-
registerType
Register or customize reflection hints for the specified type.- Parameters:
type
- the type to customizetypeHint
- a builder to further customize hints for that type- Returns:
this
, to facilitate method chaining- See Also:
-
registerType
Register or customize reflection hints for the specified type using the specifiedMemberCategories
.- Parameters:
type
- the type to customizememberCategories
- the member categories to apply- Returns:
this
, to facilitate method chaining
-
registerTypeIfPresent
public ReflectionHints registerTypeIfPresent(@Nullable ClassLoader classLoader, String typeName, Consumer<TypeHint.Builder> typeHint) Register or customize reflection hints for the specified type if it is available using the specifiedClassLoader
.- Parameters:
classLoader
- the classloader to use to check if the type is presenttypeName
- the type to customizetypeHint
- a builder to further customize hints for that type- Returns:
this
, to facilitate method chaining- See Also:
-
registerTypeIfPresent
public ReflectionHints registerTypeIfPresent(@Nullable ClassLoader classLoader, String typeName, MemberCategory... memberCategories) Register or customize reflection hints for the specified type if it is available using the specifiedClassLoader
.- Parameters:
classLoader
- the classloader to use to check if the type is presenttypeName
- the type to customizememberCategories
- the member categories to apply- Returns:
this
, to facilitate method chaining
-
registerTypes
public ReflectionHints registerTypes(Iterable<TypeReference> types, Consumer<TypeHint.Builder> typeHint) Register or customize reflection hints for the types defined by the specified list oftype references
. The specifiedtypeHint
consumer is invoked for each type.- Parameters:
types
- the types to customizetypeHint
- a builder to further customize hints for each type- Returns:
this
, to facilitate method chaining
-
registerField
Register the need for reflection on the specifiedField
.- Parameters:
field
- the field that requires reflection- Returns:
this
, to facilitate method chaining
-
registerConstructor
Register the need for reflection on the specifiedConstructor
, using the specifiedExecutableMode
.- Parameters:
constructor
- the constructor that requires reflectionmode
- the requested mode- Returns:
this
, to facilitate method chaining
-
registerMethod
Register the need for reflection on the specifiedMethod
, using the specifiedExecutableMode
.- Parameters:
method
- the method that requires reflectionmode
- the requested mode- Returns:
this
, to facilitate method chaining
-