1 22 package org.jboss.metadata.annotation; 23 24 import java.lang.annotation.Annotation ; 25 26 32 public class AbstractAnnotationImpl implements Annotation 33 { 34 35 private Class <? extends Annotation > annotationType; 36 37 42 @SuppressWarnings ("unchecked") 43 public AbstractAnnotationImpl() 44 { 45 for (Class clazz : getClass().getInterfaces()) 46 { 47 if (clazz.equals(Annotation .class) == false && (clazz.isAnnotation())) 48 { 49 annotationType = clazz; 50 return; 51 } 52 } 53 } 54 55 60 public AbstractAnnotationImpl(Class <? extends Annotation > annotationType) 61 { 62 this.annotationType = annotationType; 63 } 64 65 public Class <? extends Annotation > annotationType() 66 { 67 return annotationType; 68 } 69 70 public boolean equals(Object object) 71 { 72 if (object == this) 73 return true; 74 if (object == null || object instanceof Annotation == false) 75 return false; 76 77 Annotation other = (Annotation ) object; 78 return annotationType.equals(other.annotationType()); 79 } 80 81 public int hashCode() 82 { 83 return annotationType.hashCode(); 84 } 85 } 86 | Popular Tags |