Annotation Type RequiredModifiers


  • @Documented
    @Retention(CLASS)
    @Target(ANNOTATION_TYPE)
    public @interface RequiredModifiers
    Annotation declaring that the target annotation requires all the specified modifiers. For example, an annotation declared as:
     @RequiredModifiers(Modifier.PUBLIC)
     @interface MyAnnotation {}
     

    will be considered illegal when used on non-public elements such as:

     @MyAnnotation void foo() {}
     
    Author:
    benyu@google.com (Jige Yu)
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      Modifier[] value
      The required modifiers.
    • Element Detail

      • value

        Modifier[] value
        The required modifiers. The annotated element is illegal if any one or more of these modifiers are absent.

        Empty array has the same effect as not applying this annotation at all; duplicates are allowed but have no effect.