1 30 package org.objectweb.asm.xml; 31 32 import org.objectweb.asm.AnnotationVisitor; 33 import org.objectweb.asm.Attribute; 34 import org.objectweb.asm.FieldVisitor; 35 import org.xml.sax.ContentHandler ; 36 import org.xml.sax.SAXException ; 37 import org.xml.sax.helpers.AttributesImpl ; 38 39 44 public class SAXFieldAdapter implements FieldVisitor { 45 private final ContentHandler h; 46 47 public SAXFieldAdapter(ContentHandler h, AttributesImpl att) { 48 this.h = h; 49 50 try { 51 h.startElement("", "field", "field", att); 52 } catch (SAXException ex) { 53 throw new RuntimeException (ex.toString()); 54 } 55 } 56 57 public AnnotationVisitor visitAnnotation(String desc, boolean visible) { 58 return new SAXAnnotationAdapter(h, 59 "annotation", 60 visible ? 1 : -1, 61 null, 62 desc); 63 } 64 65 public void visitAttribute(Attribute attr) { 66 } 68 69 public void visitEnd() { 70 try { 71 h.endElement("", "field", "field"); 72 } catch (SAXException ex) { 73 throw new RuntimeException (ex.toString()); 74 } 75 } 76 77 } 78 | Popular Tags |