1 17 package org.apache.ws.jaxme.xs.jaxb.impl; 18 19 import java.util.ArrayList ; 20 import java.util.List ; 21 22 import org.apache.ws.jaxme.xs.jaxb.JAXBJavadoc; 23 import org.apache.ws.jaxme.xs.jaxb.JAXBSchemaBindings; 24 import org.apache.ws.jaxme.xs.jaxb.JAXBXsObjectFactory; 25 import org.apache.ws.jaxme.xs.xml.XsObject; 26 import org.apache.ws.jaxme.xs.xml.impl.XsObjectImpl; 27 28 29 34 public class JAXBSchemaBindingsImpl extends JAXBXsObjectImpl implements JAXBSchemaBindings { 35 private Package myPackage; 36 private List nameXmlTransforms; 37 38 public static class PackageImpl extends JAXBXsObjectImpl implements JAXBSchemaBindings.Package { 39 41 protected PackageImpl(XsObject pParent) { 42 super(pParent); 43 } 44 45 private String name; 46 private JAXBJavadoc javadoc; 47 48 public void setName(String pName) { 49 name = pName; 50 } 51 52 public String getName() { 53 return name; 54 } 55 56 public JAXBJavadoc createJavadoc() { 57 if (javadoc != null) { 58 throw new IllegalStateException ("Multiple javadoc elements are not supported."); 59 } 60 javadoc = getJAXBXsObjectFactory().newJAXBJavadoc(this); 61 return javadoc; 62 } 63 64 public JAXBJavadoc getJavadoc() { 65 return javadoc; 66 } 67 } 68 69 public static class NameXmlTransformImpl extends XsObjectImpl 70 implements JAXBSchemaBindings.NameXmlTransform { 71 public static class NameTransformationImpl extends XsObjectImpl 72 implements JAXBSchemaBindings.NameTransformation { 73 75 protected NameTransformationImpl(XsObject pParent) { 76 super(pParent); 77 } 78 79 private String suffix, prefix; 80 81 public void setSuffix(String pSuffix) { 82 suffix = pSuffix; 83 } 84 85 public String getSuffix() { 86 return suffix; 87 } 88 89 public void setPrefix(String pPrefix) { 90 prefix = pPrefix; 91 } 92 93 public String getPrefix() { 94 return prefix; 95 } 96 } 97 98 100 protected NameXmlTransformImpl(XsObject pParent) { 101 super(pParent); 102 } 103 104 private NameTransformation typeName, elementName, modelGroupName, anonymousTypeName; 105 106 public NameTransformation createTypeName() { 107 if (typeName != null) { 108 throw new IllegalStateException ("Multiple instances of typeName are not supported."); 109 } 110 typeName = ((JAXBXsObjectFactory) getObjectFactory()).newNameTransformation(this); 111 return typeName; 112 } 113 114 public NameTransformation getTypeName() { 115 return typeName; 116 } 117 118 public NameTransformation createElementName() { 119 if (elementName != null) { 120 throw new IllegalStateException ("Multiple instances of elementName are not supported."); 121 } 122 elementName = ((JAXBXsObjectFactory) getObjectFactory()).newNameTransformation(this); 123 return elementName; 124 } 125 126 public NameTransformation getElementName() { 127 return elementName; 128 } 129 130 public NameTransformation createModelGroupName() { 131 if (modelGroupName != null) { 132 throw new IllegalStateException ("Multiple instances of modelGroupName are not supported."); 133 } 134 modelGroupName = ((JAXBXsObjectFactory) getObjectFactory()).newNameTransformation(this); 135 return modelGroupName; 136 } 137 138 public NameTransformation getModelGroupName() { 139 return modelGroupName; 140 } 141 142 public NameTransformation createAnonymousTypeName() { 143 if (anonymousTypeName != null) { 144 throw new IllegalStateException ("Multiple instances of anonymousTypeName are not supported."); 145 } 146 anonymousTypeName = ((JAXBXsObjectFactory) getObjectFactory()).newNameTransformation(this); 147 return anonymousTypeName; 148 } 149 150 public NameTransformation getAnonymousTypeName() { 151 return anonymousTypeName; 152 } 153 } 154 155 158 protected JAXBSchemaBindingsImpl(XsObject pParent) { 159 super(pParent); 160 } 161 162 164 public Package createPackage() { 165 if (myPackage != null) { 166 throw new IllegalStateException ("Multiple package declarations are not supported."); 167 } 168 myPackage = ((JAXBXsObjectFactory) getObjectFactory()).newPackage(this); 169 return myPackage; 170 } 171 172 public Package getPackage() { 173 return myPackage; 174 } 175 176 178 public NameXmlTransform createNameXmlTransform() { 179 if (nameXmlTransforms == null) { 180 nameXmlTransforms = new ArrayList (); 181 } 182 NameXmlTransform result = ((JAXBXsObjectFactory) getObjectFactory()).newNameXmlTransform(this); 183 nameXmlTransforms.add(result); 184 return result; 185 } 186 187 private static final NameXmlTransform[] DEFAULT_NAME_XML_TRANSFORMATION = new NameXmlTransform[0]; 188 public NameXmlTransform[] getNameXmlTransform() { 189 if (nameXmlTransforms == null) { 190 return DEFAULT_NAME_XML_TRANSFORMATION; 191 } else { 192 return (NameXmlTransform[]) nameXmlTransforms.toArray(new NameXmlTransform[nameXmlTransforms.size()]); 193 } 194 } 195 } 196 | Popular Tags |