Interface AnnotationRemapper

  • All Known Subinterfaces:
    PackageRenameRemapper
    All Known Implementing Classes:
    FindBugsRemapper, JakartaRemapper

    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 javax.annotation.Nullable and io.micronaut.core.annotation.Nullable. One can remap these to a single annotation internally at compilation time.

    Since:
    1.2.0
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.String getPackageName()  
      java.util.List<io.micronaut.core.annotation.AnnotationValue<?>> remap​(io.micronaut.core.annotation.AnnotationValue<?> annotation, VisitorContext visitorContext)
      The map method will be called for each instances of the annotation returned via this method.
    • Method Detail

      • getPackageName

        @NonNull
        java.lang.String getPackageName()
        Returns:
        The package name of the annotation.
      • remap

        @NonNull
        java.util.List<io.micronaut.core.annotation.AnnotationValue<?>> remap​(io.micronaut.core.annotation.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