Top Description Fields Constructors Methods
org.springframework.aot.hint

public Class ReflectionHints

extends Object
Class Inheritance
Imports
java.lang.reflect.Constructor, .Executable, .Field, .Method, java.util.HashMap, .List, .Map, java.util.function.Consumer, java.util.stream.Stream, org.springframework.aot.hint.TypeHint.Builder, org.springframework.lang.Nullable, org.springframework.util.Assert, .ClassUtils

Gather the need for reflection at runtime.
Authors
Stephane Nicoll, Phillip Webb, Andy Wilkinson, Sebastien Deleuze
Since
6.0

Field Summary

Modifier and TypeField and Description
private final Map<TypeReference, TypeHint.Builder>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public TypeHint

Returns:

the reflection hints for this type, or null
getTypeHint
(TypeReference
the type to inspect
type
)

Return the reflection hints for the type defined by the specified TypeReference.

public TypeHint

Returns:

the reflection hints for this type, or null
getTypeHint
(Class<?>
the type to inspect
type
)

Return the reflection hints for the specified type.

private List<TypeReference>
public ReflectionHints

Returns:

this, to facilitate method chaining
registerConstructor
(Constructor<?>
the constructor that requires reflection
constructor
,
ExecutableMode
the requested mode
mode
)

Register the need for reflection on the specified Constructor, using the specified ExecutableMode.

public ReflectionHints

Returns:

this, to facilitate method chaining
registerField
(Field
the field that requires reflection
field
)

Register the need for reflection on the specified Field.

public ReflectionHints

Returns:

this, to facilitate method chaining
registerMethod
(Method
the method that requires reflection
method
,
ExecutableMode
the requested mode
mode
)

Register the need for reflection on the specified Method, using the specified ExecutableMode.

public ReflectionHints

Returns:

this, to facilitate method chaining
registerType
(TypeReference
the type to customize
type
,
Consumer<TypeHint.Builder>
a builder to further customize hints for that type
typeHint
)

Register or customize reflection hints for the type defined by the specified TypeReference.

public ReflectionHints

Returns:

this, to facilitate method chaining
registerType
(TypeReference
the type to customize
type
,
MemberCategory...
the member categories to apply
memberCategories
)

Register or customize reflection hints for the specified type using the specified MemberCategories.

public ReflectionHints

Returns:

this, to facilitate method chaining
registerType
(Class<?>
the type to customize
type
,
Consumer<TypeHint.Builder>
a builder to further customize hints for that type
typeHint
)

Register or customize reflection hints for the specified type.

public ReflectionHints

Returns:

this, to facilitate method chaining
registerType
(Class<?>
the type to customize
type
,
MemberCategory...
the member categories to apply
memberCategories
)

Register or customize reflection hints for the specified type using the specified MemberCategories.

public ReflectionHints

Returns:

this, to facilitate method chaining
registerTypeIfPresent
(ClassLoader
the classloader to use to check if the type is present
classLoader
,
String
the type to customize
typeName
,
Consumer<TypeHint.Builder>
a builder to further customize hints for that type
typeHint
)

Register or customize reflection hints for the specified type if it is available using the specified ClassLoader.

public ReflectionHints

Returns:

this, to facilitate method chaining
registerTypeIfPresent
(ClassLoader
the classloader to use to check if the type is present
classLoader
,
String
the type to customize
typeName
,
MemberCategory...
the member categories to apply
memberCategories
)

Register or customize reflection hints for the specified type if it is available using the specified ClassLoader.

public ReflectionHints

Returns:

this, to facilitate method chaining
registerTypes
(Iterable<TypeReference>
the types to customize
types
,
Consumer<TypeHint.Builder>
a builder to further customize hints for each type
typeHint
)

Register or customize reflection hints for the types defined by the specified list of type references.

public Stream<TypeHint>

Returns:

the type hints
typeHints
()

Return the types that require reflection.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

typesback to summary
private final Map<TypeReference, TypeHint.Builder> types

Constructor Detail

ReflectionHintsback to summary
public ReflectionHints()

Method Detail

getTypeHintback to summary
public TypeHint getTypeHint(TypeReference type)

Return the reflection hints for the type defined by the specified TypeReference.

Parameters
type:TypeReference

the type to inspect

Returns:TypeHint

the reflection hints for this type, or null

Annotations
@Nullable
getTypeHintback to summary
public TypeHint getTypeHint(Class<?> type)

Return the reflection hints for the specified type.

Parameters
type:Class<?>

the type to inspect

Returns:TypeHint

the reflection hints for this type, or null

Annotations
@Nullable
mapParametersback to summary
private List<TypeReference> mapParameters(Executable executable)
registerConstructorback to summary
public ReflectionHints registerConstructor(Constructor<?> constructor, ExecutableMode mode)

Register the need for reflection on the specified Constructor, using the specified ExecutableMode.

Parameters
constructor:Constructor<?>

the constructor that requires reflection

mode:ExecutableMode

the requested mode

Returns:ReflectionHints

this, to facilitate method chaining

registerFieldback to summary
public ReflectionHints registerField(Field field)

Register the need for reflection on the specified Field.

Parameters
field:Field

the field that requires reflection

Returns:ReflectionHints

this, to facilitate method chaining

registerMethodback to summary
public ReflectionHints registerMethod(Method method, ExecutableMode mode)

Register the need for reflection on the specified Method, using the specified ExecutableMode.

Parameters
method:Method

the method that requires reflection

mode:ExecutableMode

the requested mode

Returns:ReflectionHints

this, to facilitate method chaining

registerTypeback to summary
public ReflectionHints registerType(TypeReference type, Consumer<TypeHint.Builder> typeHint)

Register or customize reflection hints for the type defined by the specified TypeReference.

Parameters
type:TypeReference

the type to customize

typeHint:Consumer<TypeHint.Builder>

a builder to further customize hints for that type

Returns:ReflectionHints

this, to facilitate method chaining

See Also
registerType(TypeReference, MemberCategory...)
registerTypeback to summary
public ReflectionHints registerType(TypeReference type, MemberCategory... memberCategories)

Register or customize reflection hints for the specified type using the specified MemberCategories.

Parameters
type:TypeReference

the type to customize

memberCategories:MemberCategory[]

the member categories to apply

Returns:ReflectionHints

this, to facilitate method chaining

registerTypeback to summary
public ReflectionHints registerType(Class<?> type, Consumer<TypeHint.Builder> typeHint)

Register or customize reflection hints for the specified type.

Parameters
type:Class<?>

the type to customize

typeHint:Consumer<TypeHint.Builder>

a builder to further customize hints for that type

Returns:ReflectionHints

this, to facilitate method chaining

See Also
registerType(Class, MemberCategory...)
registerTypeback to summary
public ReflectionHints registerType(Class<?> type, MemberCategory... memberCategories)

Register or customize reflection hints for the specified type using the specified MemberCategories.

Parameters
type:Class<?>

the type to customize

memberCategories:MemberCategory[]

the member categories to apply

Returns:ReflectionHints

this, to facilitate method chaining

registerTypeIfPresentback to summary
public ReflectionHints registerTypeIfPresent(ClassLoader classLoader, String typeName, Consumer<TypeHint.Builder> typeHint)

Register or customize reflection hints for the specified type if it is available using the specified ClassLoader.

Parameters
classLoader:ClassLoader

the classloader to use to check if the type is present

typeName:String

the type to customize

typeHint:Consumer<TypeHint.Builder>

a builder to further customize hints for that type

Returns:ReflectionHints

this, to facilitate method chaining

See Also
registerTypeIfPresent(ClassLoader, String, MemberCategory...)
registerTypeIfPresentback to summary
public ReflectionHints registerTypeIfPresent(ClassLoader classLoader, String typeName, MemberCategory... memberCategories)

Register or customize reflection hints for the specified type if it is available using the specified ClassLoader.

Parameters
classLoader:ClassLoader

the classloader to use to check if the type is present

typeName:String

the type to customize

memberCategories:MemberCategory[]

the member categories to apply

Returns:ReflectionHints

this, to facilitate method chaining

registerTypesback to summary
public ReflectionHints registerTypes(Iterable<TypeReference> types, Consumer<TypeHint.Builder> typeHint)

Register or customize reflection hints for the types defined by the specified list of type references. The specified typeHint consumer is invoked for each type.

Parameters
types:Iterable<TypeReference>

the types to customize

typeHint:Consumer<TypeHint.Builder>

a builder to further customize hints for each type

Returns:ReflectionHints

this, to facilitate method chaining

typeHintsback to summary
public Stream<TypeHint> typeHints()

Return the types that require reflection.

Returns:Stream<TypeHint>

the type hints