From 4cb79c2713f8c039d89419d4441de5895f304e95 Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 25 Feb 2008 21:26:01 +0000 Subject: [PATCH] annoValMatch: able to ask annotation about its values and their settings --- .../bcel/classfile/annotation/Annotation.java | 25 +++++++++++++++++++ .../annotation/EnumElementValue.java | 11 ++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/Annotation.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/Annotation.java index 4b609fd06..ac81ec805 100644 --- a/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/Annotation.java +++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/Annotation.java @@ -30,6 +30,7 @@ import org.aspectj.apache.bcel.classfile.Utility; */ public class Annotation { private int typeIndex; + // OPTIMIZE don't need a new list instance for every annotation instance! private List /* ElementNameValuePair */ evs = new ArrayList(); private ConstantPool cpool; private boolean isRuntimeVisible; @@ -127,4 +128,28 @@ public class Annotation { } return result.toString(); } + + /** + * Return true if the annotation has a value with the specified name (n) and value (v) + */ + public boolean hasNameValuePair(String n, String v) { + for (int i=0;i