1 17 package org.apache.ws.jaxme.xs.jaxb.impl; 18 19 import org.apache.ws.jaxme.xs.jaxb.JAXBJavaType; 20 import org.apache.ws.jaxme.xs.parser.impl.LocSAXException; 21 import org.apache.ws.jaxme.xs.xml.XsObject; 22 import org.apache.ws.jaxme.xs.xml.XsQName; 23 import org.apache.ws.jaxme.xs.xml.impl.XsObjectImpl; 24 import org.xml.sax.SAXException ; 25 26 27 31 public class JAXBJavaTypeImpl extends XsObjectImpl implements JAXBJavaType { 32 public static class JAXBGlobalJavaTypeImpl extends JAXBJavaTypeImpl implements JAXBJavaType.JAXBGlobalJavaType { 33 35 protected JAXBGlobalJavaTypeImpl(XsObject pParent) { 36 super(pParent); 37 } 38 39 private XsQName xmlType; 40 public void setXmlType(XsQName pType) { xmlType = pType; } 41 public void setXmlType(String pType) throws SAXException { 42 String [] parts = new String [3]; 43 getNamespaceSupport().processName(pType, parts, false); 44 setXmlType(new XsQName(parts[0], parts[1], XsQName.prefixOf(pType))); 45 } 46 public XsQName getXmlType() { return xmlType; } 47 public void validate() throws SAXException { 48 super.validate(); 49 if (getXmlType() == null) { 50 throw new LocSAXException("Missing attribute: 'xmlType'", getLocator()); 51 } 52 } 53 } 54 55 private String name; 56 private boolean hasNsContext; 57 private String parseMethod, printMethod; 58 private XsQName xmlType; 59 60 62 protected JAXBJavaTypeImpl(XsObject pParent) { 63 super(pParent); 64 } 65 66 public void setName(String pName) { name = pName; } 67 public String getName() { return name; } 68 69 public void setHasNsContext(boolean pHasNsContext) { 70 hasNsContext = pHasNsContext; 71 } 72 73 public boolean hasNsContext() { 74 return hasNsContext; 75 } 76 77 public void setParseMethod(String pParseMethod) { 78 parseMethod = pParseMethod; 79 } 80 81 public String getParseMethod() { 82 return parseMethod; 83 } 84 85 public void setPrintMethod(String pPrintMethod) { 86 printMethod = pPrintMethod; 87 } 88 89 public String getPrintMethod() { 90 return printMethod; 91 } 92 93 95 public void setXmlType(String pXmlType) throws SAXException { 96 setXmlType(asXsQName(pXmlType)); 97 } 98 99 101 public void setXmlType(XsQName pXmlType) { 102 xmlType = pXmlType; 103 } 104 105 public XsQName getXmlType() { 106 return xmlType; 107 } 108 } 109 | Popular Tags |