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.

NOTE: Remapping all packages is an experimental feature and might be replaced in the future with more efficient way.
Since:
1.2.0
Author:
graemerocher
  • Field Details

  • Method Details

    • getPackageName

      @NonNull @NonNull String 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 values
      visitorContext - The context that is being visited
      Returns:
      A list of zero or many annotations and values to map to