001package io.avaje.inject.aop;
002
003import java.lang.annotation.ElementType;
004import java.lang.annotation.Retention;
005import java.lang.annotation.RetentionPolicy;
006import java.lang.annotation.Target;
007
008/**
009 * Meta annotation used to define an Aspect.
010 * <p>
011 * Create an annotation and annotate with {@code @Aspect} to define an aspect annotation. The
012 * {@link Aspect#target()} specifies the associated type that implements {@link AspectProvider}.
013 * The aspect provider should be a {@code @Singleton} such that registers with <em>avaje-inject</em>.
014 * <p>
015 */
016@Target(ElementType.ANNOTATION_TYPE)
017@Retention(RetentionPolicy.RUNTIME)
018public @interface Aspect {
019
020  /**
021   * Specify the {@link AspectProvider} for this aspect.
022   */
023  Class<?> target();
024
025  /**
026   * Specify the priority ordering when multiple aspects are on a method.
027   * <p>
028   * When multiple aspects are on a method they are nested. The highest
029   * ordering value will be the outer-most aspect, the lowest ordering will
030   * be the inner-most aspect.
031   * <p>
032   * The outer-most aspect will have it's <em>before</em> executed first,
033   * followed by the <em>before</em> of the inner nested aspects ultimately
034   * down the invocation of the target method.
035   * <p>
036   * The reverse ordering occurs for <em>after</em> with the outer-most aspect
037   * having it's <em>after</em> executed last.
038   *
039   * @return The ordering of this aspect. High value for outer-most aspect.
040   */
041  int ordering() default 1000;
042
043}