1 17 package org.apache.ws.jaxme.xs.xml.impl; 18 19 import java.util.ArrayList ; 20 import java.util.List ; 21 import java.util.StringTokenizer ; 22 23 import org.apache.ws.jaxme.xs.xml.*; 24 import org.xml.sax.SAXException ; 25 26 27 58 public class XsEUnionImpl extends XsTAnnotatedImpl implements XsEUnion { 59 public List simpleTypes; 60 public List memberTypes; 61 62 protected XsEUnionImpl(XsObject pParent) { 63 super(pParent); 64 } 65 66 public XsTLocalSimpleType createSimpleType() { 67 XsTLocalSimpleType simpleType = getObjectFactory().newXsTLocalSimpleType(this); 68 if (simpleTypes == null) { 69 simpleTypes = new ArrayList (); 70 } 71 simpleTypes.add(simpleType); 72 return simpleType; 73 } 74 75 public XsTLocalSimpleType[] getSimpleTypes() { 76 if (simpleTypes == null) { 77 return new XsTLocalSimpleType[0]; 78 } 79 return (XsTLocalSimpleType[]) simpleTypes.toArray(new XsTLocalSimpleType[simpleTypes.size()]); 80 } 81 82 public void setMemberTypes(XsQName[] pTypes) { 83 if (pTypes == null) { 84 memberTypes = null; 85 } else { 86 memberTypes = new ArrayList (); 87 for (int i = 0; i < pTypes.length; i++) { 88 memberTypes.add(pTypes[i]); 89 } 90 } 91 } 92 93 public void setMemberTypes(String pTypes) throws SAXException { 94 if (pTypes == null) { 95 setMemberTypes((XsQName[]) null); 96 } else { 97 List myMemberTypes = new ArrayList (); 98 for (StringTokenizer st = new StringTokenizer (pTypes); st.hasMoreTokens(); ) { 99 String s = st.nextToken(); 100 XsQName qName = asXsQName(s); 101 myMemberTypes.add(qName); 102 } 103 setMemberTypes((XsQName[]) myMemberTypes.toArray(new XsQName[myMemberTypes.size()])); 104 } 105 } 106 107 public XsQName[] getMemberTypes() { 108 if (memberTypes == null) { 109 return null; 110 } 111 return (XsQName[]) memberTypes.toArray(new XsQName[memberTypes.size()]); 112 } 113 } 114 | Popular Tags |