KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ws > jaxme > xs > jaxb > impl > JAXBGroupImpl


1 /*
2  * Copyright 2003, 2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15
16  */

17 package org.apache.ws.jaxme.xs.jaxb.impl;
18
19 import org.apache.ws.jaxme.xs.XSObject;
20 import org.apache.ws.jaxme.xs.impl.XSGroupImpl;
21 import org.apache.ws.jaxme.xs.impl.XSUtil;
22 import org.apache.ws.jaxme.xs.jaxb.JAXBClass;
23 import org.apache.ws.jaxme.xs.jaxb.JAXBGroup;
24 import org.apache.ws.jaxme.xs.jaxb.JAXBSchemaBindings;
25 import org.apache.ws.jaxme.xs.jaxb.JAXBXsSchema;
26 import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
27 import org.apache.ws.jaxme.xs.xml.XsEChoice;
28 import org.apache.ws.jaxme.xs.xml.XsESequence;
29 import org.apache.ws.jaxme.xs.xml.XsTAll;
30 import org.apache.ws.jaxme.xs.xml.XsTGroupRef;
31 import org.apache.ws.jaxme.xs.xml.XsTNamedGroup;
32 import org.xml.sax.SAXException JavaDoc;
33
34
35 /**
36  * @author <a HREF="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
37  */

38 public class JAXBGroupImpl extends XSGroupImpl implements JAXBGroup {
39   private JAXBClass jaxbClass;
40
41   /** <p>Creates a new instance of JAXBGroupImpl.</p>
42    */

43   protected JAXBGroupImpl(XSObject pParent, XsTGroupRef pBaseGroup)
44       throws SAXException {
45     super(pParent, pBaseGroup);
46   }
47
48   /** <p>Creates a new instance of JAXBGroupImpl.</p>
49    */

50   protected JAXBGroupImpl(XSObject pParent, XsTNamedGroup pBaseGroup)
51       throws SAXException {
52     super(pParent, pBaseGroup);
53   }
54
55   /** <p>Creates a new instance of JAXBGroupImpl.</p>
56    */

57   protected JAXBGroupImpl(XSObject pParent, XsEChoice pChoice)
58       throws SAXException {
59     super(pParent, pChoice);
60   }
61
62   /** <p>Creates a new instance of JAXBGroupImpl.</p>
63    */

64   protected JAXBGroupImpl(XSObject pParent, XsESequence pSequence)
65       throws SAXException {
66     super(pParent, pSequence);
67   }
68
69   /** <p>Creates a new instance of JAXBGroupImpl.</p>
70    */

71   public JAXBGroupImpl(XSObject pParent, XsTAll pAll)
72       throws SAXException {
73     super(pParent, pAll);
74   }
75
76   public JAXBSchemaBindings getJAXBSchemaBindings() {
77     return ((JAXBXsSchema) getXsObject().getXsESchema()).getJAXBSchemaBindings();
78   }
79
80   public JAXBClass getJAXBClass() {
81     return jaxbClass;
82   }
83
84   public void validate() throws SAXException {
85     if (isValidated()) {
86       return;
87     }
88     super.validate();
89     jaxbClass = (JAXBClass) XSUtil.getSingleAppinfo(getAnnotations(), JAXBClass.class);
90
91     if (!isGlobal() && jaxbClass != null && jaxbClass.getImplClass() != null) {
92       throw new LocSAXException("The implClass attribute is valid for global groups only.",
93                                  jaxbClass.getLocator());
94     }
95   }
96 }
97
Popular Tags