aboutsummaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authoraclement <aclement>2008-02-25 21:42:43 +0000
committeraclement <aclement>2008-02-25 21:42:43 +0000
commitecf4237a6326ac2ff5b4b4eac3ee5e798c5fcdd3 (patch)
treec8da45bdbaf67d6adfa76dbf2184e03a3d0aa590 /weaver
parentfeaf0017acec0b8f609f63c02f85604c05a06ddb (diff)
downloadaspectj-ecf4237a6326ac2ff5b4b4eac3ee5e798c5fcdd3.tar.gz
aspectj-ecf4237a6326ac2ff5b4b4eac3ee5e798c5fcdd3.zip
annoValMatch: implementation
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/org/aspectj/weaver/reflect/AnnotationFinder.java5
-rw-r--r--weaver/src/org/aspectj/weaver/reflect/ReflectionBasedResolvedMemberImpl.java22
2 files changed, 26 insertions, 1 deletions
diff --git a/weaver/src/org/aspectj/weaver/reflect/AnnotationFinder.java b/weaver/src/org/aspectj/weaver/reflect/AnnotationFinder.java
index 8fa69f425..bdc3539af 100644
--- a/weaver/src/org/aspectj/weaver/reflect/AnnotationFinder.java
+++ b/weaver/src/org/aspectj/weaver/reflect/AnnotationFinder.java
@@ -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);
diff --git a/weaver/src/org/aspectj/weaver/reflect/ReflectionBasedResolvedMemberImpl.java b/weaver/src/org/aspectj/weaver/reflect/ReflectionBasedResolvedMemberImpl.java
index fb9debd15..ef3a2ab9a 100644
--- a/weaver/src/org/aspectj/weaver/reflect/ReflectionBasedResolvedMemberImpl.java
+++ b/weaver/src/org/aspectj/weaver/reflect/ReflectionBasedResolvedMemberImpl.java
@@ -12,12 +12,15 @@
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);
}