View Javadoc

1   package com.atlassian.plugins.rest.common.feature;
2   
3   import java.lang.annotation.ElementType;
4   import java.lang.annotation.Retention;
5   import java.lang.annotation.RetentionPolicy;
6   import java.lang.annotation.Target;
7   
8   /**
9    * Marks a REST resource class or method as requiring that the given dark feature(s) are enabled.
10   * <p>
11   * Allows multiple feature keys to be specified, in which case ALL are required to be enabled (e.g. flags are treated as an AND condition).
12   * <p>
13   * The annotation can be applied at the resource class and method level to allow fine-grained control of access.
14   *
15   * e.g.
16   * <pre>
17   *     &#064;RequiresDarkFeature("my.plugin.enabled")
18   *     &#064;Path("/")
19   *     class MyResource
20   *     {
21   *         ...
22   *         &#064;GET
23   *         &#064;Produces("application/json")
24   *         &#064;RequiresDarkFeature("my.plugin.feature1")
25   *         public Response getSomething()
26   *         {
27   *             ...
28   *         }
29   *     }
30   * </pre>
31   */
32  @Target({ElementType.TYPE, ElementType.METHOD})
33  @Retention(RetentionPolicy.RUNTIME)
34  public @interface RequiresDarkFeature {
35      /**
36       * The list of dark feature keys that are required. Treated as an AND.
37       */
38      String[] value();
39  }