]> source.dussan.org Git - aspectj.git/commitdiff
annoValMatch: implementation
authoraclement <aclement>
Mon, 25 Feb 2008 21:42:43 +0000 (21:42 +0000)
committeraclement <aclement>
Mon, 25 Feb 2008 21:42:43 +0000 (21:42 +0000)
weaver/src/org/aspectj/weaver/reflect/AnnotationFinder.java
weaver/src/org/aspectj/weaver/reflect/ReflectionBasedResolvedMemberImpl.java

index 8fa69f4254a8aca449243fae6b063b94991c1a7a..bdc3539aff1c778c5ed69f942945b57530362d70 100644 (file)
@@ -14,7 +14,9 @@ package org.aspectj.weaver.reflect;
 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;
 
 /**
@@ -30,7 +32,10 @@ public interface AnnotationFinder {
        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);
index fb9debd15a656bd552386afdfa7da235faa70077..ef3a2ab9a05372b1db9f8a6beea8c10d92d2ece0 100644 (file)
 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
@@ -168,8 +171,25 @@ public class ReflectionBasedResolvedMemberImpl extends ResolvedMemberImpl {
                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);
        }