KickJava   Java API By Example, From Geeks To Geeks.

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


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.jaxb.JAXBJavaType;
20 import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
21 import org.apache.ws.jaxme.xs.xml.XsObject;
22 import org.apache.ws.jaxme.xs.xml.XsQName;
23 import org.apache.ws.jaxme.xs.xml.impl.XsObjectImpl;
24 import org.xml.sax.SAXException JavaDoc;
25
26
27 /**
28  * @author <a HREF="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
29  * @version $Id: JAXBJavaTypeImpl.java,v 1.3 2004/09/30 00:09:30 jochen Exp $
30  */

31 public class JAXBJavaTypeImpl extends XsObjectImpl implements JAXBJavaType {
32   public static class JAXBGlobalJavaTypeImpl extends JAXBJavaTypeImpl implements JAXBJavaType.JAXBGlobalJavaType {
33     /** <p>Creates a new instance of JAXBJavaTypeImpl.java.</p>
34      */

35     protected JAXBGlobalJavaTypeImpl(XsObject pParent) {
36       super(pParent);
37     }
38
39     private XsQName xmlType;
40     public void setXmlType(XsQName pType) { xmlType = pType; }
41     public void setXmlType(String JavaDoc pType) throws SAXException {
42       String JavaDoc[] parts = new String JavaDoc[3];
43       getNamespaceSupport().processName(pType, parts, false);
44       setXmlType(new XsQName(parts[0], parts[1], XsQName.prefixOf(pType)));
45     }
46     public XsQName getXmlType() { return xmlType; }
47     public void validate() throws SAXException {
48       super.validate();
49       if (getXmlType() == null) {
50         throw new LocSAXException("Missing attribute: 'xmlType'", getLocator());
51       }
52     }
53   }
54
55   private String JavaDoc name;
56   private boolean hasNsContext;
57   private String JavaDoc parseMethod, printMethod;
58   private XsQName xmlType;
59
60   /** <p>Creates a new instance of JAXBJavaTypeImpl.java.</p>
61    */

62   protected JAXBJavaTypeImpl(XsObject pParent) {
63     super(pParent);
64   }
65
66   public void setName(String JavaDoc pName) { name = pName; }
67   public String JavaDoc getName() { return name; }
68
69   public void setHasNsContext(boolean pHasNsContext) {
70     hasNsContext = pHasNsContext;
71   }
72
73   public boolean hasNsContext() {
74     return hasNsContext;
75   }
76
77   public void setParseMethod(String JavaDoc pParseMethod) {
78     parseMethod = pParseMethod;
79   }
80
81   public String JavaDoc getParseMethod() {
82     return parseMethod;
83   }
84
85   public void setPrintMethod(String JavaDoc pPrintMethod) {
86     printMethod = pPrintMethod;
87   }
88
89   public String JavaDoc getPrintMethod() {
90     return printMethod;
91   }
92
93   /** Sets the XML Type being customized by this element.
94    */

95   public void setXmlType(String JavaDoc pXmlType) throws SAXException {
96     setXmlType(asXsQName(pXmlType));
97   }
98
99   /** Sets the XML Type being customized by this element.
100    */

101   public void setXmlType(XsQName pXmlType) {
102     xmlType = pXmlType;
103   }
104
105   public XsQName getXmlType() {
106     return xmlType;
107   }
108 }
109
Popular Tags