1 17 package org.apache.ws.jaxme.xs.xml.impl; 18 19 import org.apache.ws.jaxme.xs.parser.impl.LocSAXException; 20 import org.apache.ws.jaxme.xs.xml.*; 21 import org.xml.sax.SAXException ; 22 23 24 54 public class XsTAttributeImpl extends XsTAnnotatedImpl implements XsTAttribute { 55 private XsTLocalSimpleType simpleType; 56 private XsQName type; 57 private Use use = OPTIONAL; 58 private String defaultValue; 59 private String fixedValue; 60 private XsFormChoice form; 61 private XsNCName name; 62 private XsQName ref; 63 64 protected XsTAttributeImpl(XsObject pParent) { 65 super(pParent); 66 } 67 68 public XsTLocalSimpleType createSimpleType() { 69 if (simpleType != null) { 70 throw new IllegalStateException ("Multiple 'simpleType' child elements are forbidden."); 71 } 72 if (type != null) { 73 throw new IllegalStateException ("The 'type' attribute and the 'simpleType' child element are mutually exclusive."); 74 } 75 return simpleType = getObjectFactory(). newXsTLocalSimpleType(this); 76 } 77 78 public XsTLocalSimpleType getSimpleType() { 79 return simpleType; 80 } 81 82 public void setType(XsQName pType) { 83 if (simpleType != null) { 84 throw new IllegalStateException ("The 'type' attribute and the 'simpleType' child element are mutually exclusive."); 85 } 86 type = pType; 87 } 88 89 public void setType(String pType) throws SAXException { 90 setType(asXsQName(pType)); 91 } 92 93 public XsQName getType() { 94 return type; 95 } 96 97 public void setUse(Use pUse) { 98 use = pUse; 99 } 100 101 public Use getUse() { 102 return use; 103 } 104 105 public void setDefault(String pDefault) { 106 defaultValue = pDefault; 107 } 108 109 public String getDefault() { 110 return defaultValue; 111 } 112 113 public void setFixed(String pFixed) { 114 fixedValue = pFixed; 115 } 116 117 public String getFixed() { 118 return fixedValue; 119 } 120 121 public void setForm(XsFormChoice pForm) throws SAXException { 122 if (isGlobal() && pForm != null) { 123 throw new LocSAXException("The 'form' attribute is valid for local attributes only.", 124 getLocator()); 125 } 126 form = pForm; 127 } 128 129 public XsFormChoice getForm() { 130 return form; 131 } 132 133 public void setName(XsNCName pName) { 134 name = pName; 135 } 136 137 public XsNCName getName() { 138 return name; 139 } 140 141 public void setRef(XsQName pRef) { 142 ref = pRef; 143 } 144 145 public void setRef(String pRef) throws SAXException { 146 setRef(asXsQName(pRef)); 147 } 148 149 public XsQName getRef() { 150 return ref; 151 } 152 153 public boolean isGlobal() { return isTopLevelObject(); } 154 } 155 | Popular Tags |