1 7 8 package org.dom4j.bean; 9 10 import org.dom4j.Element; 11 import org.dom4j.QName; 12 import org.dom4j.tree.AbstractAttribute; 13 14 23 public class BeanAttribute extends AbstractAttribute { 24 25 private final BeanAttributeList beanList; 26 27 28 private final int index; 29 30 public BeanAttribute(BeanAttributeList beanList, int index) { 31 this.beanList = beanList; 32 this.index = index; 33 } 34 35 public QName getQName() { 36 return beanList.getQName(index); 37 } 38 39 public Element getParent() { 40 return beanList.getParent(); 41 } 42 43 public String getValue() { 44 Object data = getData(); 45 46 return (data != null) ? data.toString() : null; 47 } 48 49 public void setValue(String data) { 50 beanList.setData(index, data); 51 } 52 53 public Object getData() { 54 return beanList.getData(index); 55 } 56 57 public void setData(Object data) { 58 beanList.setData(index, data); 59 } 60 } 61 62 98 | Popular Tags |