1 30 package org.objectweb.asm.tree; 31 32 import org.objectweb.asm.Attribute; 33 import org.objectweb.asm.ClassVisitor; 34 import org.objectweb.asm.FieldVisitor; 35 36 41 public class FieldNode extends MemberNode implements FieldVisitor { 42 43 47 public int access; 48 49 52 public String name; 53 54 57 public String desc; 58 59 62 public String signature; 63 64 69 public Object value; 70 71 85 public FieldNode( 86 final int access, 87 final String name, 88 final String desc, 89 final String signature, 90 final Object value) 91 { 92 this.access = access; 93 this.name = name; 94 this.desc = desc; 95 this.signature = signature; 96 this.value = value; 97 } 98 99 104 public void accept(final ClassVisitor cv) { 105 FieldVisitor fv = cv.visitField(access, name, desc, signature, value); 106 int i, n; 107 n = visibleAnnotations == null ? 0 : visibleAnnotations.size(); 108 for (i = 0; i < n; ++i) { 109 AnnotationNode an = (AnnotationNode) visibleAnnotations.get(i); 110 an.accept(fv.visitAnnotation(an.desc, true)); 111 } 112 n = invisibleAnnotations == null ? 0 : invisibleAnnotations.size(); 113 for (i = 0; i < n; ++i) { 114 AnnotationNode an = (AnnotationNode) invisibleAnnotations.get(i); 115 an.accept(fv.visitAnnotation(an.desc, false)); 116 } 117 n = attrs == null ? 0 : attrs.size(); 118 for (i = 0; i < n; ++i) { 119 fv.visitAttribute((Attribute) attrs.get(i)); 120 } 121 fv.visitEnd(); 122 } 123 } 124 | Popular Tags |