aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/javassist/bytecode/annotation/ClassMemberValue.java
diff options
context:
space:
mode:
authorpatriot1burke <patriot1burke@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2004-09-14 04:17:29 +0000
committerpatriot1burke <patriot1burke@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2004-09-14 04:17:29 +0000
commit02c99beb983350fa2ae2808ea35c9416cd63db5b (patch)
treee490038a492d128f4f4e1b7ff9e70e838bd4c2fd /src/main/javassist/bytecode/annotation/ClassMemberValue.java
parent1e8cb81f354dfd68a5ae033a7ebc9ddae1152e37 (diff)
downloadjavassist-02c99beb983350fa2ae2808ea35c9416cd63db5b.tar.gz
javassist-02c99beb983350fa2ae2808ea35c9416cd63db5b.zip
* additional methods to AnnotationsAttribute to support adding
* turn off pruning. * move toClass back to ClassPool git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@137 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src/main/javassist/bytecode/annotation/ClassMemberValue.java')
-rw-r--r--src/main/javassist/bytecode/annotation/ClassMemberValue.java132
1 files changed, 72 insertions, 60 deletions
diff --git a/src/main/javassist/bytecode/annotation/ClassMemberValue.java b/src/main/javassist/bytecode/annotation/ClassMemberValue.java
index 78a6217d..09a1075b 100644
--- a/src/main/javassist/bytecode/annotation/ClassMemberValue.java
+++ b/src/main/javassist/bytecode/annotation/ClassMemberValue.java
@@ -17,6 +17,7 @@ package javassist.bytecode.annotation;
import javassist.bytecode.ConstPool;
import javassist.bytecode.Descriptor;
+
import java.io.IOException;
/**
@@ -25,72 +26,83 @@ import java.io.IOException;
* @author <a href="mailto:bill@jboss.org">Bill Burke</a>
* @author Shigeru Chiba
*/
-public class ClassMemberValue extends MemberValue {
- int valueIndex;
+public class ClassMemberValue extends MemberValue
+{
+ int valueIndex;
- /**
- * Constructs a string constant value. The initial value is specified
- * by the constant pool entry at the given index.
- *
- * @param index the index of a CONSTANT_Utf8_info structure.
- */
- public ClassMemberValue(int index, ConstPool cp) {
- super('c', cp);
- this.valueIndex = index;
- }
+ /**
+ * Constructs a string constant value. The initial value is specified
+ * by the constant pool entry at the given index.
+ *
+ * @param index the index of a CONSTANT_Utf8_info structure.
+ */
+ public ClassMemberValue(int index, ConstPool cp)
+ {
+ super('c', cp);
+ this.valueIndex = index;
+ }
- /**
- * Constructs a string constant value.
- *
- * @param className the initial value.
- */
- public ClassMemberValue(String className, ConstPool cp) {
- super('c', cp);
- setValue(className);
- }
+ /**
+ * Constructs a string constant value.
+ *
+ * @param className the initial value.
+ */
+ public ClassMemberValue(String className, ConstPool cp)
+ {
+ super('c', cp);
+ setValue(className);
+ }
- /**
- * Constructs a string constant value.
- * The initial value is java.lang.Class.
- */
- public ClassMemberValue(ConstPool cp) {
- super('c', cp);
- setValue("java.lang.Class");
- }
+ /**
+ * Constructs a string constant value.
+ * The initial value is java.lang.Class.
+ */
+ public ClassMemberValue(ConstPool cp)
+ {
+ super('c', cp);
+ setValue("java.lang.Class");
+ }
- /**
- * Obtains the value of the member.
- *
- * @return fully-qualified class name.
- */
- public String getValue() {
- return Descriptor.toClassName(cp.getUtf8Info(valueIndex));
- }
+ /**
+ * Obtains the value of the member.
+ *
+ * @return fully-qualified class name.
+ */
+ public String getValue()
+ {
+ String v = cp.getUtf8Info(valueIndex);
+ return Descriptor.toClassName(v);
+ }
- /**
- * Sets the value of the member.
- *
- * @param newClassName fully-qualified class name.
- */
- public void setValue(String newClassName) {
- valueIndex = cp.addUtf8Info(Descriptor.of(newClassName));
- }
+ /**
+ * Sets the value of the member.
+ *
+ * @param newClassName fully-qualified class name.
+ */
+ public void setValue(String newClassName)
+ {
+ String setTo = Descriptor.of(newClassName);
+ valueIndex = cp.addUtf8Info(setTo);
+ }
- /**
- * Obtains the string representation of this object.
- */
- public String toString() {
- return "<" + getValue() + " class>";
- }
+ /**
+ * Obtains the string representation of this object.
+ */
+ public String toString()
+ {
+ return "<" + getValue() + " class>";
+ }
- void write(AnnotationsWriter writer) throws IOException {
- writer.constValueIndex(getValue());
- }
+ void write(AnnotationsWriter writer) throws IOException
+ {
+ writer.classInfoIndex(valueIndex);
+ }
- /**
- * Accepts a visitor.
- */
- public void accept(MemberValueVisitor visitor) {
- visitor.visitClassMemberValue(this);
- }
+ /**
+ * Accepts a visitor.
+ */
+ public void accept(MemberValueVisitor visitor)
+ {
+ visitor.visitClassMemberValue(this);
+ }
}