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
-
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) Register the need for reflection on the specifiedConstructor
, enablingExecutableMode.INVOKE
.registerConstructor
(Constructor<?> constructor, Consumer<ExecutableHint.Builder> constructorHint) Register the need for reflection on the specifiedConstructor
.registerField
(Field field) Register the need for reflection on the specifiedField
, enabling write access.registerField
(Field field, Consumer<FieldHint.Builder> fieldHint) Register the need for reflection on the specifiedField
.registerMethod
(Method method) Register the need for reflection on the specifiedMethod
, enablingExecutableMode.INVOKE
.registerMethod
(Method method, Consumer<ExecutableHint.Builder> methodHint) Register the need for reflection on the specifiedMethod
.registerType
(Class<?> type, Consumer<TypeHint.Builder> typeHint) Register or customize reflection hints for the specified type.registerType
(TypeReference type, Consumer<TypeHint.Builder> typeHint) Register or customize reflection hints for the type defined by the specifiedTypeReference
.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
-
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
-
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 reflectionfieldHint
- a builder to further customize the hints of this field- Returns:
this
, to facilitate method chaining
-
registerField
Register the need for reflection on the specifiedField
, enabling write access.- Parameters:
field
- the field that requires reflection- Returns:
this
, to facilitate method chaining
-
registerConstructor
public ReflectionHints registerConstructor(Constructor<?> constructor, Consumer<ExecutableHint.Builder> constructorHint) Register the need for reflection on the specifiedConstructor
.- Parameters:
constructor
- the constructor that requires reflectionconstructorHint
- a builder to further customize the hints of this constructor- Returns:
this
, to facilitate method chaining
-
registerConstructor
Register the need for reflection on the specifiedConstructor
, enablingExecutableMode.INVOKE
.- Parameters:
constructor
- the constructor that requires reflection- Returns:
this
, to facilitate method chaining
-
registerMethod
Register the need for reflection on the specifiedMethod
.- Parameters:
method
- the method that requires reflectionmethodHint
- a builder to further customize the hints of this method- Returns:
this
, to facilitate method chaining
-
registerMethod
Register the need for reflection on the specifiedMethod
, enablingExecutableMode.INVOKE
.- Parameters:
method
- the method that requires reflection- Returns:
this
, to facilitate method chaining
-