public @interface MyAnnotation {
int value() default 0;
String name() default "";
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface MyMetaAnnotation {
}
@SupportedAnnotationTypes("com.example.MyAnnotation")
@SupportedSourceVersion(SourceVersion.RELEASE_8)
public class MyAnnotationProcessor extends AbstractProcessor {
}
MyAnnotation annotation = someObject.getClass().getAnnotation(MyAnnotation.class);
int value = annotation.value();
String name = annotation.name();