Copier(byte[] info, ConstPool src, ConstPool dest, Map map, boolean makeWriter) { super(info); output = new ByteArrayOutputStream(); if (makeWriter) writer = new AnnotationsWriter(output, dest); srcPool = src; destPool = dest; classnames = map; }
Copier(byte[] info, ConstPool src, ConstPool dest, Map<String,String> map, boolean makeWriter) { super(info); output = new ByteArrayOutputStream(); if (makeWriter) writer = new AnnotationsWriter(output, dest); srcPool = src; destPool = dest; classnames = map; }
/** * Changes the default value represented by this attribute. * * @param value the new value. * @see javassist.bytecode.annotation.Annotation#createMemberValue(ConstPool, CtClass) */ public void setDefaultValue(MemberValue value) { ByteArrayOutputStream output = new ByteArrayOutputStream(); AnnotationsWriter writer = new AnnotationsWriter(output, constPool); try { value.write(writer); writer.close(); } catch (IOException e) { throw new RuntimeException(e); // should never reach here. } set(output.toByteArray()); }
/** * Changes the annotations represented by this object according to * the given array of <code>Annotation</code> objects. * * @param annotations the data structure representing the * new annotations. */ public void setAnnotations(Annotation[] annotations) { ByteArrayOutputStream output = new ByteArrayOutputStream(); AnnotationsWriter writer = new AnnotationsWriter(output, constPool); try { int n = annotations.length; writer.numAnnotations(n); for (int i = 0; i < n; ++i) annotations[i].write(writer); writer.close(); } catch (IOException e) { throw new RuntimeException(e); // should never reach here. } set(output.toByteArray()); }
/** * Changes the default value represented by this attribute. * * @param value the new value. * @see javassist.bytecode.annotation.Annotation#createMemberValue(ConstPool, CtClass) */ public void setDefaultValue(MemberValue value) { ByteArrayOutputStream output = new ByteArrayOutputStream(); AnnotationsWriter writer = new AnnotationsWriter(output, constPool); try { value.write(writer); writer.close(); } catch (IOException e) { throw new RuntimeException(e); // should never reach here. } set(output.toByteArray()); }
/** * Changes the annotations represented by this object according to * the given array of <code>Annotation</code> objects. * * @param params the data structure representing the * new annotations. Every element of this array * is an array of <code>Annotation</code> and * it represens annotations of each method parameter. */ public void setAnnotations(Annotation[][] params) { ByteArrayOutputStream output = new ByteArrayOutputStream(); AnnotationsWriter writer = new AnnotationsWriter(output, constPool); try { int n = params.length; writer.numParameters(n); for (int i = 0; i < n; ++i) { Annotation[] anno = params[i]; writer.numAnnotations(anno.length); for (int j = 0; j < anno.length; ++j) anno[j].write(writer); } writer.close(); } catch (IOException e) { throw new RuntimeException(e); // should never reach here. } set(output.toByteArray()); }
/** * Changes the annotations represented by this object according to * the given array of <code>Annotation</code> objects. * * @param annotations the data structure representing the * new annotations. */ public void setAnnotations(Annotation[] annotations) { ByteArrayOutputStream output = new ByteArrayOutputStream(); AnnotationsWriter writer = new AnnotationsWriter(output, constPool); try { int n = annotations.length; writer.numAnnotations(n); for (int i = 0; i < n; ++i) annotations[i].write(writer); writer.close(); } catch (IOException e) { throw new RuntimeException(e); // should never reach here. } set(output.toByteArray()); }
/** * Changes the annotations represented by this object according to * the given array of <code>Annotation</code> objects. * * @param params the data structure representing the * new annotations. Every element of this array * is an array of <code>Annotation</code> and * it represens annotations of each method parameter. */ public void setAnnotations(Annotation[][] params) { ByteArrayOutputStream output = new ByteArrayOutputStream(); AnnotationsWriter writer = new AnnotationsWriter(output, constPool); try { writer.numParameters(params.length); for (Annotation[] anno:params) { writer.numAnnotations(anno.length); for (int j = 0; j < anno.length; ++j) anno[j].write(writer); } writer.close(); } catch (IOException e) { throw new RuntimeException(e); // should never reach here. } set(output.toByteArray()); }
/** * Constructs a copier. This copier renames some class names * into the new names specified by <code>map</code> when it copies * an annotation attribute. * * @param info the source attribute. * @param src the constant pool of the source class. * @param dest the constant pool of the destination class. * @param map pairs of replaced and substituted class names. * It can be null. */ Copier(byte[] info, ConstPool src, ConstPool dest, Map map) { super(info); output = new ByteArrayOutputStream(); writer = new AnnotationsWriter(output, dest); srcPool = src; destPool = dest; classnames = map; }
/** * Constructs a copier. This copier renames some class names * into the new names specified by <code>map</code> when it copies * an annotation attribute. * * @param info the source attribute. * @param src the constant pool of the source class. * @param dest the constant pool of the destination class. * @param map pairs of replaced and substituted class names. * It can be null. */ Copier(byte[] info, ConstPool src, ConstPool dest, Map map) { super(info); output = new ByteArrayOutputStream(); writer = new AnnotationsWriter(output, dest); srcPool = src; destPool = dest; classnames = map; }
/** * Constructs a copier. This copier renames some class names * into the new names specified by <code>map</code> when it copies * an annotation attribute. * * @param info the source attribute. * @param src the constant pool of the source class. * @param dest the constant pool of the destination class. * @param map pairs of replaced and substituted class names. * It can be null. */ Copier(byte[] info, ConstPool src, ConstPool dest, Map map) { super(info); output = new ByteArrayOutputStream(); writer = new AnnotationsWriter(output, dest); srcPool = src; destPool = dest; classnames = map; }
/** * Constructs a copier. This copier renames some class names * into the new names specified by <code>map</code> when it copies * an annotation attribute. * * @param info the source attribute. * @param src the constant pool of the source class. * @param dest the constant pool of the destination class. * @param map pairs of replaced and substituted class names. * It can be null. */ Copier(byte[] info, ConstPool src, ConstPool dest, Map map) { super(info); output = new ByteArrayOutputStream(); writer = new AnnotationsWriter(output, dest); srcPool = src; destPool = dest; classnames = map; }
/** * Constructs a copier. This copier renames some class names * into the new names specified by <code>map</code> when it copies * an annotation attribute. * * @param info the source attribute. * @param src the constant pool of the source class. * @param dest the constant pool of the destination class. * @param map pairs of replaced and substituted class names. * It can be null. */ Copier(byte[] info, ConstPool src, ConstPool dest, Map map) { super(info); output = new ByteArrayOutputStream(); writer = new AnnotationsWriter(output, dest); srcPool = src; destPool = dest; classnames = map; }
/** * Changes the default value represented by this attribute. * * @param value the new value. * @see javassist.bytecode.annotation.Annotation#createMemberValue(ConstPool, CtClass) */ public void setDefaultValue(MemberValue value) { ByteArrayOutputStream output = new ByteArrayOutputStream(); AnnotationsWriter writer = new AnnotationsWriter(output, constPool); try { value.write(writer); writer.close(); } catch (IOException e) { throw new RuntimeException(e); // should never reach here. } set(output.toByteArray()); }
/** * Changes the default value represented by this attribute. * * @param value the new value. * @see javassist.bytecode.annotation.Annotation#createMemberValue(ConstPool, CtClass) */ public void setDefaultValue(MemberValue value) { ByteArrayOutputStream output = new ByteArrayOutputStream(); AnnotationsWriter writer = new AnnotationsWriter(output, constPool); try { value.write(writer); writer.close(); } catch (IOException e) { throw new RuntimeException(e); // should never reach here. } set(output.toByteArray()); }
/** * Changes the default value represented by this attribute. * * @param value the new value. * @see javassist.bytecode.annotation.Annotation#createMemberValue(ConstPool, CtClass) */ public void setDefaultValue(MemberValue value) { ByteArrayOutputStream output = new ByteArrayOutputStream(); AnnotationsWriter writer = new AnnotationsWriter(output, constPool); try { value.write(writer); writer.close(); } catch (IOException e) { throw new RuntimeException(e); // should never reach here. } set(output.toByteArray()); }
/** * Changes the default value represented by this attribute. * * @param value the new value. * @see javassist.bytecode.annotation.Annotation#createMemberValue(ConstPool, CtClass) */ public void setDefaultValue(MemberValue value) { ByteArrayOutputStream output = new ByteArrayOutputStream(); AnnotationsWriter writer = new AnnotationsWriter(output, constPool); try { value.write(writer); writer.close(); } catch (IOException e) { throw new RuntimeException(e); // should never reach here. } set(output.toByteArray()); }
/** * Changes the default value represented by this attribute. * * @param value the new value. * @see javassist.bytecode.annotation.Annotation#createMemberValue(ConstPool, CtClass) */ public void setDefaultValue(MemberValue value) { ByteArrayOutputStream output = new ByteArrayOutputStream(); AnnotationsWriter writer = new AnnotationsWriter(output, constPool); try { value.write(writer); writer.close(); } catch (IOException e) { throw new RuntimeException(e); // should never reach here. } set(output.toByteArray()); }
/** * Changes the annotations represented by this object according to * the given array of <code>Annotation</code> objects. * * @param annotations the data structure representing the * new annotations. */ public void setAnnotations(Annotation[] annotations) { ByteArrayOutputStream output = new ByteArrayOutputStream(); AnnotationsWriter writer = new AnnotationsWriter(output, constPool); try { int n = annotations.length; writer.numAnnotations(n); for (int i = 0; i < n; ++i) annotations[i].write(writer); writer.close(); } catch (IOException e) { throw new RuntimeException(e); // should never reach here. } set(output.toByteArray()); }
/** * Changes the annotations represented by this object according to * the given array of <code>Annotation</code> objects. * * @param annotations the data structure representing the * new annotations. */ public void setAnnotations(Annotation[] annotations) { ByteArrayOutputStream output = new ByteArrayOutputStream(); AnnotationsWriter writer = new AnnotationsWriter(output, constPool); try { int n = annotations.length; writer.numAnnotations(n); for (int i = 0; i < n; ++i) annotations[i].write(writer); writer.close(); } catch (IOException e) { throw new RuntimeException(e); // should never reach here. } set(output.toByteArray()); }