1 17 package org.apache.ws.jaxme.generator.sg.impl; 18 19 import org.apache.ws.jaxme.generator.sg.ComplexTypeSG; 20 import org.apache.ws.jaxme.generator.sg.PropertySG; 21 import org.apache.ws.jaxme.generator.sg.PropertySGChain; 22 import org.apache.ws.jaxme.generator.sg.SimpleContentSG; 23 import org.apache.ws.jaxme.generator.sg.SimpleContentSGChain; 24 import org.apache.ws.jaxme.generator.sg.TypeSG; 25 import org.apache.ws.jaxme.xs.XSType; 26 import org.xml.sax.SAXException ; 27 28 29 32 public class JAXBSimpleContentTypeSG implements SimpleContentSGChain { 33 private XSType xsType; 34 private PropertySG propertySG; 35 private final TypeSG typeSG, contentTypeSG; 36 37 39 protected JAXBSimpleContentTypeSG(ComplexTypeSG pComplexTypeSG, XSType pType) throws SAXException { 40 xsType = pType; 41 typeSG = pComplexTypeSG.getTypeSG(); 42 XSType theSimpleType = pType.getComplexType().getSimpleContent().getType(); 43 contentTypeSG = typeSG.getFactory().getTypeSG(theSimpleType, pComplexTypeSG.getClassContext(), null); 44 } 45 46 public Object newPropertySGChain(SimpleContentSG pController) throws SAXException { 47 if (xsType == null) { 48 throw new IllegalStateException ("A new PropertySG has already been created."); 49 } 50 PropertySGChain result = new JAXBPropertySG(typeSG, xsType); 51 xsType = null; return result; 53 } 54 55 public void init(SimpleContentSG pController) throws SAXException { 56 PropertySGChain chain = (PropertySGChain) pController.newPropertySGChain(); 57 propertySG = new PropertySGImpl(chain); 58 propertySG.init(); 59 } 60 61 public PropertySG getPropertySG(SimpleContentSG pController) throws SAXException { return propertySG; } 62 public TypeSG getTypeSG(SimpleContentSG pController) throws SAXException { return typeSG; } 63 public TypeSG getContentTypeSG(SimpleContentSG pController) throws SAXException { return contentTypeSG; } 64 } 65 | Popular Tags |