Package io.quarkus.runtime.annotations
Annotation Interface RegisterForReflection
Annotation that can be used to force a class to be registered for reflection in native image mode.
Note that by default the class itself is registered including nested classes and interfaces,
but not the full class hierarchy. This can be changed by setting:
ignoreNested()
to true, to ignore nested classes.registerFullHierarchy()
to true, to register the full hierarchy.
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionString[]
This allows for classes to be registered for reflection via class names.boolean
If the fields should be registeredboolean
If nested classes/interfaces should be ignored.String[]
The lambda capturing types performing serialization in the native imageboolean
If the methods should be registeredboolean
If the full class hierarchy and dependencies should be registered.boolean
Class<?>[]
Alternative classes that should actually be registered for reflection instead of the current class.boolean
-
Element Details
-
methods
boolean methodsIf the methods should be registered- Default:
- true
-
fields
boolean fieldsIf the fields should be registered- Default:
- true
-
ignoreNested
boolean ignoreNestedIf nested classes/interfaces should be ignored. By default, nested classes are registered. To ignore them set it to true.- Default:
- false
-
targets
Class<?>[] targetsAlternative classes that should actually be registered for reflection instead of the current class. This allows for classes in 3rd party libraries to be registered without modification or writing an extension. If this is set then the class it is placed on is not registered for reflection, so this should generally just be placed on an empty class that is not otherwise used.- Default:
- {}
-
classNames
String[] classNamesThis allows for classes to be registered for reflection via class names. This is useful when it's necessary to register private classes for Reflection.- Default:
- {}
-
serialization
boolean serialization- Default:
- false
-
unsafeAllocated
boolean unsafeAllocated- Default:
- false
-
lambdaCapturingTypes
String[] lambdaCapturingTypesThe lambda capturing types performing serialization in the native image- Default:
- {}
-
registerFullHierarchy
boolean registerFullHierarchyIf the full class hierarchy and dependencies should be registered. This is useful in order to use a class to be transfered through a restful service API- Returns:
- Default:
- false
-