diff options
author | aclement <aclement> | 2011-11-17 17:45:00 +0000 |
---|---|---|
committer | aclement <aclement> | 2011-11-17 17:45:00 +0000 |
commit | e8a2793d601e0ee47f1f7a491ec657aad5add5de (patch) | |
tree | d9aac75c390e13336e832f2221fe290198fb33a3 /bcel-builder/src | |
parent | 942da06faacec35b0aab76eb2729e55b174e3c97 (diff) | |
download | aspectj-e8a2793d601e0ee47f1f7a491ec657aad5add5de.tar.gz aspectj-e8a2793d601e0ee47f1f7a491ec657aad5add5de.zip |
missing impl for annotation value handling, time to fill it in
Diffstat (limited to 'bcel-builder/src')
-rw-r--r-- | bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/AnnotationElementValue.java | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/AnnotationElementValue.java b/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/AnnotationElementValue.java index 1b2d4023d..2e6024580 100644 --- a/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/AnnotationElementValue.java +++ b/bcel-builder/src/org/aspectj/apache/bcel/classfile/annotation/AnnotationElementValue.java @@ -14,8 +14,11 @@ package org.aspectj.apache.bcel.classfile.annotation; import java.io.DataOutputStream; import java.io.IOException; +import java.util.List; +import org.aspectj.apache.bcel.Constants; import org.aspectj.apache.bcel.classfile.ConstantPool; +import org.aspectj.apache.bcel.classfile.ConstantUtf8; public class AnnotationElementValue extends ElementValue { @@ -45,7 +48,22 @@ public class AnnotationElementValue extends ElementValue { @Override public String stringifyValue() { - throw new RuntimeException("Not implemented yet"); + StringBuffer sb = new StringBuffer(); + ConstantUtf8 cu8 = (ConstantUtf8) cpool.getConstant(a.getTypeIndex(), Constants.CONSTANT_Utf8); + sb.append(cu8.getValue()); + // haven't really tested this values section: + List<NameValuePair> pairs = a.getValues(); + if (pairs != null && pairs.size() > 0) { + sb.append("("); + for (int p = 0; p < pairs.size(); p++) { + if (p > 0) { + sb.append(","); + } + sb.append(pairs.get(p).getNameString()).append("=").append(pairs.get(p).getValue().stringifyValue()); + } + sb.append(")"); + } + return sb.toString(); } public AnnotationGen getAnnotation() { |