if (value instanceof String[]) { String[] typeconst = (String[]) value; av.visitEnum(name, typeconst[0], typeconst[1]); } else if (value instanceof AnnotationNode) { AnnotationNode an = (AnnotationNode) value; an.accept(av.visitAnnotation(name, an.desc)); } else if (value instanceof List) { AnnotationVisitor v = av.visitArray(name); if (v != null) { List<?> array = (List<?>) value; accept(v, null, array.get(j)); v.visitEnd(); av.visit(name, value);
/** * Visits the end of the annotation. */ public void visitEnd() { if (av != null) { av.visitEnd(); } } }
/** * Visits a primitive value of the annotation. * * @param name the value name. * @param value the actual value, whose type must be {@link Byte}, {@link Boolean}, {@link * Character}, {@link Short}, {@link Integer} , {@link Long}, {@link Float}, {@link Double}, * {@link String} or {@link Type} of {@link Type#OBJECT} or {@link Type#ARRAY} sort. This * value can also be an array of byte, boolean, short, char, int, long, float or double values * (this is equivalent to using {@link #visitArray} and visiting each array element in turn, * but is more convenient). */ public void visit(final String name, final Object value) { if (av != null) { av.visit(name, value); } }
/** * Visits an array value of the annotation. Note that arrays of primitive types (such as byte, * boolean, short, char, int, long, float or double) can be passed as value to {@link #visit * visit}. This is what {@link ClassReader} does. * * @param name the value name. * @return a visitor to visit the actual array value elements, or {@literal null} if this visitor * is not interested in visiting these values. The 'name' parameters passed to the methods of * this visitor are ignored. <i>All the array values must be visited before calling other * methods on this annotation visitor</i>. */ public AnnotationVisitor visitArray(final String name) { if (av != null) { return av.visitArray(name); } return null; }
/** * Visits an enumeration value of the annotation. * * @param name the value name. * @param descriptor the class descriptor of the enumeration class. * @param value the actual enumeration value. */ public void visitEnum(final String name, final String descriptor, final String value) { if (av != null) { av.visitEnum(name, descriptor, value); } }
byte[] b = (byte[]) value; for (int i = 0; i < b.length; i++) { av.visit(null, b[i]); char[] b = (char[]) value; for (int i = 0; i < b.length; i++) { av.visit(null, b[i]); short[] b = (short[]) value; for (int i = 0; i < b.length; i++) { av.visit(null, b[i]); boolean[] b = (boolean[]) value; for (int i = 0; i < b.length; i++) { av.visit(null, Boolean.valueOf(b[i])); int[] b = (int[]) value; for (int i = 0; i < b.length; i++) { av.visit(null, b[i]); long[] b = (long[]) value; for (int i = 0; i < b.length; i++) { av.visit(null, b[i]); float[] b = (float[]) value; for (int i = 0; i < b.length; i++) { av.visit(null, b[i]); double[] b = (double[]) value;
/** * Visits a nested annotation value of the annotation. * * @param name the value name. * @param descriptor the class descriptor of the nested annotation class. * @return a visitor to visit the actual nested annotation value, or {@literal null} if this * visitor is not interested in visiting this nested annotation. <i>The nested annotation * value must be fully visited before calling other methods on this annotation visitor</i>. */ public AnnotationVisitor visitAnnotation(final String name, final String descriptor) { if (av != null) { return av.visitAnnotation(name, descriptor); } return null; }
/** Visits the end of the annotation. */ public void visitEnd() { if (av != null) { av.visitEnd(); } } }
/** * Visits a primitive value of the annotation. * * @param name * the value name. * @param value * the actual value, whose type must be {@link Byte}, * {@link Boolean}, {@link Character}, {@link Short}, * {@link Integer} , {@link Long}, {@link Float}, {@link Double}, * {@link String} or {@link Type} of OBJECT or ARRAY sort. This * value can also be an array of byte, boolean, short, char, int, * long, float or double values (this is equivalent to using * {@link #visitArray visitArray} and visiting each array element * in turn, but is more convenient). */ public void visit(String name, Object value) { if (av != null) { av.visit(name, value); } }
/** * Visits an array value of the annotation. Note that arrays of primitive * types (such as byte, boolean, short, char, int, long, float or double) * can be passed as value to {@link #visit visit}. This is what * {@link ClassReader} does. * * @param name * the value name. * @return a visitor to visit the actual array value elements, or * <tt>null</tt> if this visitor is not interested in visiting these * values. The 'name' parameters passed to the methods of this * visitor are ignored. <i>All the array values must be visited * before calling other methods on this annotation visitor</i>. */ public AnnotationVisitor visitArray(String name) { if (av != null) { return av.visitArray(name); } return null; }
/** * Visits an enumeration value of the annotation. * * @param name * the value name. * @param desc * the class descriptor of the enumeration class. * @param value * the actual enumeration value. */ public void visitEnum(String name, String desc, String value) { if (av != null) { av.visitEnum(name, desc, value); } }
/** * Visits a nested annotation value of the annotation. * * @param name * the value name. * @param desc * the class descriptor of the nested annotation class. * @return a visitor to visit the actual nested annotation value, or * <tt>null</tt> if this visitor is not interested in visiting this * nested annotation. <i>The nested annotation value must be fully * visited before calling other methods on this annotation * visitor</i>. */ public AnnotationVisitor visitAnnotation(String name, String desc) { if (av != null) { return av.visitAnnotation(name, desc); } return null; }
AnnotationVisitor subAv = av.visitArray(apv.getProperty()); Object[] array = (Object[]) apv.getValue(); for (Object o : array) { subAv.visit(null,o); subAv.visitEnd(); break; case PRIMARRAY: av.visit(apv.getProperty(),apv.getValue()); break; case ENUMARRAY: AnnotationVisitor subEnav = av.visitArray(apv.getProperty()); Enum[] enArray = (Enum[]) apv.getValue(); String aenumType = "L" + BuildUtils.getInternalType(enArray[0].getClass().getName()) + ";"; for (Enum enumer : enArray) { subEnav.visitEnum(null,aenumType,enumer.name()); subEnav.visitEnd(); break; case CLASSARRAY: AnnotationVisitor subKlav = av.visitArray(apv.getProperty()); Class[] klarray = (Class[]) apv.getValue(); for (Class klass : klarray) { subKlav.visit(null,Type.getType("L"+BuildUtils.getInternalType(klass.getName())+";")); subKlav.visitEnd(); break; case ENUMERATION: String enumType = "L" + BuildUtils.getInternalType(apv.getType().getName()) + ";";
public void visitEnd() { if (av != null) { av.visitEnd(); } }
@Override public void visit(final String name, final Object value) { p.visit(name, value); super.visit(name, value); }
@Override public AnnotationVisitor visitArray(String name) { AnnotationVisitor v = av.visitArray(name); return v == null ? null : (v == av ? this : new RemappingAnnotationAdapter(v, remapper)); } }
@Override public void begin(final String nm, final Attributes attrs) { AnnotationVisitor av = (AnnotationVisitor) peek(); if (av != null) { av.visitEnum(attrs.getValue("name"), attrs.getValue("desc"), attrs.getValue("value")); } } }
@Override public void begin(final String nm, final Attributes attrs) { AnnotationVisitor av = (AnnotationVisitor) peek(); push(av == null ? null : av.visitAnnotation(attrs.getValue("name"), attrs.getValue("desc"))); }
AnnotationVisitor subAv = av.visitArray(apv.getProperty()); Object[] array = (Object[]) apv.getValue(); for (Object o : array) { subAv.visit(null,o); subAv.visitEnd(); break; case PRIMARRAY: av.visit(apv.getProperty(),apv.getValue()); break; case ENUMARRAY: AnnotationVisitor subEnav = av.visitArray(apv.getProperty()); Enum[] enArray = (Enum[]) apv.getValue(); String aenumType = "L" + BuildUtils.getInternalType(enArray[0].getClass().getName()) + ";"; for (Enum enumer : enArray) { subEnav.visitEnum(null,aenumType,enumer.name()); subEnav.visitEnd(); break; case CLASSARRAY: AnnotationVisitor subKlav = av.visitArray(apv.getProperty()); Class[] klarray = (Class[]) apv.getValue(); for (Class klass : klarray) { subKlav.visit(null,Type.getType("L"+BuildUtils.getInternalType(klass.getName())+";")); subKlav.visitEnd(); break; case ENUMERATION: String enumType = "L" + BuildUtils.getInternalType(apv.getType().getName()) + ";";