1 43 44 package org.jfree.xml.parser.coretypes; 45 46 import org.jfree.xml.parser.AbstractXmlReadHandler; 47 import org.xml.sax.Attributes ; 48 import org.xml.sax.SAXException ; 49 50 53 public class ObjectRefHandler extends AbstractXmlReadHandler { 54 55 56 private Object object; 57 58 59 private String propertyName; 60 61 64 public ObjectRefHandler() { 65 super(); 66 } 67 68 75 protected void startParsing(final Attributes attrs) throws SAXException { 76 final String tagName = getTagName(); 77 if (tagName.equals("objectRef")) { 78 final String sourceName = attrs.getValue("source"); 79 if (sourceName == null) { 80 throw new SAXException ("Source name is not defined."); 81 } 82 this.propertyName = attrs.getValue("property"); 83 if (this.propertyName == null) { 84 throw new SAXException ("Property name is not defined."); 85 } 86 87 this.object = getRootHandler().getHelperObject(sourceName); 88 if (this.object == null) { 89 throw new SAXException ("Referenced object is undefined."); 90 } 91 } 92 } 93 94 99 public String getPropertyName() { 100 return this.propertyName; 101 } 102 103 108 public Object getObject() { 109 return this.object; 110 } 111 112 } 113 | Popular Tags |