1 17 package org.apache.ws.jaxme.xs.xml.impl; 18 19 import org.apache.ws.jaxme.xs.xml.*; 20 21 22 44 public class XsESimpleContentImpl extends XsTAnnotatedImpl implements XsESimpleContent { 45 private XsTSimpleRestrictionType restriction; 46 private XsTSimpleExtensionType extension; 47 48 protected XsESimpleContentImpl(XsObject pParent) { 49 super(pParent); 50 } 51 52 public XsTSimpleRestrictionType createRestriction() { 53 if (restriction != null) { 54 throw new IllegalStateException ("Multiple 'restriction' elements are forbidden."); 55 } 56 if (extension != null) { 57 throw new IllegalStateException ("The 'restriction' and 'extension' child elements are mutually exclusive."); 58 } 59 return restriction = getObjectFactory().newXsTSimpleRestrictionType(this); 60 } 61 62 public XsTSimpleRestrictionType getRestriction() { 63 return restriction; 64 } 65 66 public XsTSimpleExtensionType createExtension() { 67 if (extension != null) { 68 throw new IllegalStateException ("Multiple 'extension' elements are forbidden."); 69 } 70 if (restriction != null) { 71 throw new IllegalStateException ("The 'restriction' and 'extension' child elements are mutually exclusive."); 72 } 73 return extension = getObjectFactory().newXsTSimpleExtensionType(this); 74 } 75 76 public XsTSimpleExtensionType getExtension() { 77 return extension; 78 } 79 80 public void validate() { 81 if (extension == null && restriction == null) { 82 throw new IllegalStateException ("You must set either of the 'extension' or 'restriction' child elements."); 83 } 84 } 85 } 86 | Popular Tags |