Class Annotations

java.lang.Object
revxrsal.commands.annotation.dynamic.Annotations

public final class Annotations extends Object
A utility for constructing annotations dynamically.

Re-adapted from Guice.

  • Constructor Details

    • Annotations

      public Annotations()
  • Method Details

    • create

      @NotNull public static <T extends Annotation> T create(@NotNull @NotNull Class<T> type)
      Creates a new annotation with no values. Any default values will automatically be used.
      Type Parameters:
      T - Annotation type
      Parameters:
      type - The annotation type
      Returns:
      The newly created annotation
    • create

      @NotNull public static <T extends Annotation> T create(@NotNull @NotNull Class<T> type, @NotNull @NotNull Map<String,Object> members)
      Creates a new annotation with the given map values. Any default values will automatically be used if not specified in the map.

      Note that the map may also use Suppliers instead of direct values.

      Type Parameters:
      T - Annotation type
      Parameters:
      type - The annotation type
      members - The annotation members
      Returns:
      The newly created annotation
    • create

      @NotNull public static <T extends Annotation> T create(@NotNull @NotNull Class<T> type, @NotNull @NotNull Object... members)
      Creates a new annotation with the given map values. Any default values will automatically be used if not specified in the map.

      Note that the map may also use Suppliers instead of direct values.

      Type Parameters:
      T - Annotation type
      Parameters:
      type - The annotation type
      Returns:
      The newly created annotation