Interface AnnotationReplacer<T>

Type Parameters:
T - Annotation to replace

public interface AnnotationReplacer<T>
An interface that allows creating annotations that will get replaced by others.

This can be exceptionally powerful (and dangerous), as it can create dynamic annotations, whose values are not restricted by static, compile-time known ones.

It also allows building shortcut annotations, as well as configurable values inside annotations.

Register with CommandHandler.registerAnnotationReplacer(Class, AnnotationReplacer)

  • Method Details

    • replaceAnnotations

      @Nullable @Nullable Collection<Annotation> replaceAnnotations(@NotNull @NotNull AnnotatedElement element, @NotNull T annotation)
      Returns a collection of annotations that will substitute the given annotation, and be accessible in CommandAnnotationHolder.getAnnotation(Class).
      Parameters:
      element - The element (method, parameter, class, etc.)
      annotation - The annotation to replace.
      Returns:
      The list of replacing annotations. The collection may be null or empty.