116 // Constructor
117 // ------------------------------------------------------------------------
118
119 /**
120 * Constructs a new {@link AnnotationWriter}.
121 *
122 * @param cw
123 * the class writer to which this annotation must be added.
124 * @param named
125 * <tt>true<tt> if values are named, <tt>false</tt> otherwise.
126 * @param bv
127 * where the annotation values must be stored.
128 * @param parent
129 * where the number of annotation values must be stored.
130 * @param offset
131 * where in <tt>parent</tt> the number of annotation values must
132 * be stored.
133 */
134 AnnotationWriter(final ClassWriter cw, final boolean named,
135 final ByteVector bv, final ByteVector parent, final int offset) {
136 super(Opcodes.ASM5);
137 this.cw = cw;
138 this.named = named;
139 this.bv = bv;
140 this.parent = parent;
141 this.offset = offset;
142 }
143
144 // ------------------------------------------------------------------------
145 // Implementation of the AnnotationVisitor abstract class
146 // ------------------------------------------------------------------------
147
148 @Override
149 public void visit(final String name, final Object value) {
150 ++size;
151 if (named) {
152 bv.putShort(cw.newUTF8(name));
153 }
154 if (value instanceof String) {
155 bv.put12('s', cw.newUTF8((String) value));
156 } else if (value instanceof Byte) {
|
116 // Constructor
117 // ------------------------------------------------------------------------
118
119 /**
120 * Constructs a new {@link AnnotationWriter}.
121 *
122 * @param cw
123 * the class writer to which this annotation must be added.
124 * @param named
125 * <tt>true<tt> if values are named, <tt>false</tt> otherwise.
126 * @param bv
127 * where the annotation values must be stored.
128 * @param parent
129 * where the number of annotation values must be stored.
130 * @param offset
131 * where in <tt>parent</tt> the number of annotation values must
132 * be stored.
133 */
134 AnnotationWriter(final ClassWriter cw, final boolean named,
135 final ByteVector bv, final ByteVector parent, final int offset) {
136 super(Opcodes.ASM6);
137 this.cw = cw;
138 this.named = named;
139 this.bv = bv;
140 this.parent = parent;
141 this.offset = offset;
142 }
143
144 // ------------------------------------------------------------------------
145 // Implementation of the AnnotationVisitor abstract class
146 // ------------------------------------------------------------------------
147
148 @Override
149 public void visit(final String name, final Object value) {
150 ++size;
151 if (named) {
152 bv.putShort(cw.newUTF8(name));
153 }
154 if (value instanceof String) {
155 bv.put12('s', cw.newUTF8((String) value));
156 } else if (value instanceof Byte) {
|