1 17 package org.apache.ws.jaxme.xs.xml.impl; 18 19 import org.apache.ws.jaxme.xs.xml.*; 20 21 22 90 public class XsTComplexTypeImpl extends XsTAnnotatedImpl implements XsTComplexType { 91 private XsESimpleContent simpleContent; 92 private XsEComplexContent complexContent; 93 private final XsGTypeDefParticle particle; 94 private final XsGAttrDecls attrDecls; 95 private boolean isParticleInUse, isMixed, isAbstract; 96 private XsDerivationSet finalSet; 97 private XsNCName name; 98 99 protected XsTComplexTypeImpl(XsObject pParent) { 100 super(pParent); 101 particle = getObjectFactory().newXsGTypeDefParticle(this); 102 attrDecls = getObjectFactory().newXsGAttrDecls(this); 103 } 104 105 public XsDerivationSet getFinal() { 106 return finalSet; 107 } 108 109 public void setFinal(XsDerivationSet pFinal) { 110 finalSet = pFinal; 111 } 112 113 public XsESimpleContent createSimpleContent() { 114 if (simpleContent != null) { 115 throw new IllegalStateException ("Multiple 'simpleContent' elements are forbidden."); 116 } 117 if (complexContent != null || isParticleInUse) { 118 throw new IllegalStateException ("The child elements 'simpleContent', 'complexContent', 'group', 'all', 'sequence', or 'choice' are mutually exclusive."); 119 } 120 return simpleContent = getObjectFactory().newXsESimpleContent(this); 121 } 122 123 public XsESimpleContent getSimpleContent() { 124 return simpleContent; 125 } 126 127 public XsEComplexContent createComplexContent() { 128 if (complexContent != null) { 129 throw new IllegalStateException ("Multiple 'complexContent' elements are forbidden."); 130 } 131 if (simpleContent != null || isParticleInUse) { 132 throw new IllegalStateException ("The child elements 'simpleContent', 'complexContent', 'group', 'all', 'sequence', or 'choice' are mutually exclusive."); 133 } 134 return complexContent = getObjectFactory().newXsEComplexContent(this); 135 } 136 137 public XsEComplexContent getComplexContent() { 138 return complexContent; 139 } 140 141 public XsTGroupRef createGroup() { 142 if (simpleContent != null || complexContent != null || isParticleInUse) { 143 throw new IllegalStateException ("The child elements 'simpleContent', 'complexContent', 'group', 'all', 'sequence', or 'choice' are mutually exclusive."); 144 } 145 isParticleInUse = true; 146 return particle.createGroup(); 147 } 148 149 public XsTAll createAll() { 150 if (simpleContent != null || complexContent != null || isParticleInUse) { 151 throw new IllegalStateException ("The child elements 'simpleContent', 'complexContent', 'group', 'all', 'sequence', or 'choice' are mutually exclusive."); 152 } 153 isParticleInUse = true; 154 return particle.createAll(); 155 } 156 157 public XsEChoice createChoice() { 158 if (simpleContent != null || complexContent != null || isParticleInUse) { 159 throw new IllegalStateException ("The child elements 'simpleContent', 'complexContent', 'group', 'all', 'sequence', or 'choice' are mutually exclusive."); 160 } 161 isParticleInUse = true; 162 return particle.createChoice(); 163 } 164 165 public XsESequence createSequence() { 166 if (simpleContent != null || complexContent != null || isParticleInUse) { 167 throw new IllegalStateException ("The child elements 'simpleContent', 'complexContent', 'group', 'all', 'sequence', or 'choice' are mutually exclusive."); 168 } 169 isParticleInUse = true; 170 return particle.createSequence(); 171 } 172 173 public XsTTypeDefParticle getTypeDefParticle() { 174 return particle.getTypeDefParticle(); 175 } 176 177 public XsTAttribute createAttribute() { 178 return attrDecls.createAttribute(); 179 } 180 181 public XsTAttribute[] getAttributes() { 182 return attrDecls.getAttributes(); 183 } 184 185 public XsTAttributeGroupRef createAttributeGroup() { 186 return attrDecls.createAttributeGroup(); 187 } 188 189 public XsTAttributeGroupRef[] getAttributeGroups() { 190 return attrDecls.getAttributeGroups(); 191 } 192 193 public XsTWildcard createAnyAttribute() { 194 return attrDecls.createAnyAttribute(); 195 } 196 197 public XsTWildcard getAnyAttribute() { 198 return attrDecls.getAnyAttribute(); 199 } 200 201 public Object [] getAllAttributes() { 202 return attrDecls.getAllAttributes(); 203 } 204 205 public void setName(XsNCName pName) { 206 name = pName; 207 } 208 209 public XsNCName getName() { 210 return name; 211 } 212 213 public boolean isAbstract() { 214 return isAbstract; 215 } 216 217 public void setAbstract(boolean pAbstract) { 218 isAbstract = pAbstract; 219 } 220 221 public boolean isMixed() { 222 return isMixed; 223 } 224 225 public void setMixed(boolean pMixed) { 226 isMixed = pMixed; 227 } 228 } 229 | Popular Tags |