import java.lang.reflect.Member;
import java.util.Set;
+import org.aspectj.weaver.AnnotationX;
import org.aspectj.weaver.ResolvedType;
+import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.World;
/**
Object getAnnotation(ResolvedType annotationType, Object onObject);
Object getAnnotationFromMember(ResolvedType annotationType, Member aMember);
+ public AnnotationX getAnnotationOfType(UnresolvedType ofType,Member onMember);
+ public String getAnnotationDefaultValue(Member onMember);
+
Object getAnnotationFromClass(ResolvedType annotationType, Class aClass);
Set/*ResolvedType*/ getAnnotations(Member onMember);
package org.aspectj.weaver.reflect;
import java.lang.reflect.Member;
+import java.util.Iterator;
+import org.aspectj.weaver.AnnotationX;
import org.aspectj.weaver.ResolvedMember;
import org.aspectj.weaver.ResolvedMemberImpl;
import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.UnresolvedType;
+
/**
* Subtype of ResolvedMemberImpl used in reflection world.
* Knows how to get annotations from a java.lang.reflect.Member
unpackAnnotations();
return super.getAnnotationTypes();
}
+
+ public AnnotationX getAnnotationOfType(UnresolvedType ofType) {
+ unpackAnnotations();
+ if (annotationFinder==null) return null;
+ for (Iterator iterator = annotationTypes.iterator(); iterator.hasNext();) {
+ ResolvedType type = (ResolvedType) iterator.next();
+ if (type.getSignature().equals(ofType.getSignature())) {
+ return annotationFinder.getAnnotationOfType(ofType, reflectMember);
+ }
+ }
+ return null;
+ }
+
+ public String getAnnotationDefaultValue() {
+ if (annotationFinder==null) return null;
+ return annotationFinder.getAnnotationDefaultValue(reflectMember);
+ }
- public ResolvedType[][] getParameterAnnotationTypes() {
+ public ResolvedType[][] getParameterAnnotationTypes() {
if (parameterAnnotationTypes==null && annotationFinder!=null) {
parameterAnnotationTypes = annotationFinder.getParameterAnnotationTypes(reflectMember);
}