Java - Annotation Member Enum Type

Introduction

An annotation can have elements of an enum type.

enum ReviewStatus {PENDING, FAILED, PASSED, Good}; 
@interface Review { 
        ReviewStatus status() default ReviewStatus.PENDING; 
        String comments() default ""; 

} 

Usage

 
enum ReviewStatus {
  PENDING, FAILED, PASSED, Good
}

@interface Review {
  ReviewStatus status()

  default ReviewStatus.PENDING;

  String comments() default "";

}

@Review(status = ReviewStatus.PASSED)
class Test {
  // Have default for status and comments. Maybe code is new
  @Review()
  int d;
  // Leave status as Pending, but add some comments
  @Review(comments = "this is a test")
  int c;
  // Fail the review with comments
  @Review(status = ReviewStatus.FAILED, comments = "comments")
  int b;
  // Pass the review without changes
  @Review(status = ReviewStatus.PASSED)
  int a;
}