Package io.micronaut.inject.annotation
Interface AnnotationRemapper
- All Known Subinterfaces:
PackageRenameRemapper
- All Known Implementing Classes:
FindBugsRemapper
,InterceptorBindingMembers
,JavaxRemapper
,QualifierBindingMembers
public interface AnnotationRemapper
Allows remapping of annotations from one annotation set to another at compilation time.
Similar to the
AnnotationMapper
interface with the following differences:
- Can be applied to a whole package of annotations.
- The original annotation being mapped is not retained in the metadata.
Useful for supporting multiple annotation sets that reside in different package namespaces, however are largely
similar in function, for example jakarta.annotation.Nullable
and io.micronaut.core.annotation.Nullable
. One can
remap these to a single annotation internally at compilation time.
- Since:
- 1.2.0
- Author:
- graemerocher
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Return this value ingetPackageName()
to trigger remap on all annotations. -
Method Summary
Modifier and TypeMethodDescriptionremap
(AnnotationValue<?> annotation, VisitorContext visitorContext) The map method will be called for each instances of the annotation returned via this method.
-
Field Details
-
ALL_PACKAGES
Return this value ingetPackageName()
to trigger remap on all annotations.- See Also:
-
-
Method Details
-
getPackageName
- Returns:
- The package name of the annotation.
-
remap
@NonNull @NonNull List<AnnotationValue<?>> remap(AnnotationValue<?> annotation, VisitorContext visitorContext) The map method will be called for each instances of the annotation returned via this method.- Parameters:
annotation
- The annotation valuesvisitorContext
- The context that is being visited- Returns:
- A list of zero or many annotations and values to map to
-