1 57 58 package clients.zipcode; 59 60 import javax.xml.namespace.QName ; 61 62 import org.w3c.dom.Element ; 63 64 68 public class ShortZipCodeFormatHandler implements PartFormatHandler { 69 70 71 private ShortZipCode dataBean = null; 72 private ShortZipCode_ElementContentType nativeFormat = new ShortZipCode_ElementContentType(); 73 private QName dataBeanQName; 74 75 public void setCustomBeanQName(javax.xml.namespace.QName qName){ 76 this.dataBeanQName = qName; 77 if(nativeFormat != null){ 78 nativeFormat.changeLocalName(dataBeanQName.getLocalPart()); 79 nativeFormat.changeNamespaceURI(dataBeanQName.getNamespaceURI()); 80 } 81 } 82 83 public javax.xml.namespace.QName getCustomBeanQName(){ 84 return this.dataBeanQName; 85 } 86 87 90 public void setCustomBean(Object customBean) { 91 dataBean = (ShortZipCode)customBean; 92 nativeFormat.setAccessCode(dataBean.getAccessCode()); 93 nativeFormat.setAddress(dataBean.getAddress()); 94 nativeFormat.setCity(dataBean.getCity()); 95 nativeFormat.setState(dataBean.getState()); 96 } 97 98 101 public Object getCustomBean() { 102 dataBean.setAccessCode(nativeFormat.getAccessCode()); 103 dataBean.setAddress(nativeFormat.getAddress()); 104 dataBean.setCity(nativeFormat.getCity()); 105 dataBean.setState(nativeFormat.getState()); 106 return dataBean; 107 } 108 109 112 public void setElement(Element element) { 113 nativeFormat.populateFrom(element); 114 } 115 116 119 public Element getElement() { 120 return nativeFormat.createElement(); 121 } 122 123 } 124 | Popular Tags |