5 public class AnnotationDescriptor extends Descriptor {
7 public static final int MARKER_ANNOTATION = 1;
8 public static final int SINGLE_ANNOTATION = 2;
9 public static final int FULL_ANNOTATION = 3;
11 private String marker;
12 private String data; // for single annotation
15 public AnnotationDescriptor(String annotationName) {
16 // constructor for marker annotation
17 super(annotationName);
18 this.marker = annotationName;
19 this.type = MARKER_ANNOTATION;
22 public AnnotationDescriptor(String annotationName, String data) {
23 // constructor for marker annotation
24 super(annotationName);
25 this.marker = annotationName;
26 this.type = SINGLE_ANNOTATION;
30 public int getType() {
34 public boolean isMarkerAnnotation() {
35 return type == MARKER_ANNOTATION;
38 public boolean isSingleAnnotation() {
39 return type == SINGLE_ANNOTATION;
42 public boolean isFullAnnotation() {
43 return type == FULL_ANNOTATION;
46 public String getMarker() {
50 public String getData(){
54 public boolean equals(Object o) {
55 if (o instanceof AnnotationDescriptor) {
56 AnnotationDescriptor a = (AnnotationDescriptor) o;
57 if (a.getType() != type)
59 if (!a.getMarker().equals(getMarker()))
67 public String toString() {
68 if (type == MARKER_ANNOTATION) {
71 return "@" + name + "()";