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
Constructors -
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) Deprecated.registerConstructor(Constructor<?> constructor, Consumer<ExecutableHint.Builder> constructorHint) Deprecated.in favor ofregisterConstructor(Constructor, ExecutableMode)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) Deprecated.in favor ofregisterMethod(Method, ExecutableMode)registerMethod(Method method, Consumer<ExecutableHint.Builder> methodHint) Deprecated.in favor ofregisterMethod(Method, ExecutableMode)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 specifiedtypeHintconsumer 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
Deprecated.in favor ofregisterConstructor(Constructor, ExecutableMode)Register the need for reflection on the specifiedConstructor, enablingExecutableMode.INVOKE.- Parameters:
constructor- the constructor 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
-
registerConstructor
@Deprecated public ReflectionHints registerConstructor(Constructor<?> constructor, Consumer<ExecutableHint.Builder> constructorHint) Deprecated.in favor ofregisterConstructor(Constructor, ExecutableMode)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`
-
registerMethod
Deprecated.in favor ofregisterMethod(Method, ExecutableMode)Register the need for reflection on the specifiedMethod, enablingExecutableMode.INVOKE.- Parameters:
method- the method that requires reflection- 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
-
registerMethod
@Deprecated public ReflectionHints registerMethod(Method method, Consumer<ExecutableHint.Builder> methodHint) Deprecated.in favor ofregisterMethod(Method, ExecutableMode)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
-
registerConstructor(Constructor, ExecutableMode)