KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ws > jaxme > generator > sg > TypeSG


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.generator.sg;
18
19 import org.apache.ws.jaxme.js.JavaField;
20 import org.apache.ws.jaxme.js.JavaMethod;
21 import org.apache.ws.jaxme.js.JavaQName;
22 import org.apache.ws.jaxme.js.JavaSource;
23 import org.apache.ws.jaxme.xs.xml.XsQName;
24 import org.apache.ws.jaxme.xs.xml.XsSchemaHeader;
25 import org.apache.ws.jaxme.generator.sg.ComplexTypeSG;
26 import org.apache.ws.jaxme.generator.sg.SGItem;
27 import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
28 import org.xml.sax.SAXException JavaDoc;
29
30
31 /** <p>Interface of a source generator for types; applies both to
32  * simple and complex types.</p>
33  *
34  * @author <a HREF="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
35  */

36 public interface TypeSG extends SGItem {
37   /** <p>A property allows to store custom data related to the type.
38    * Properties are used by external source generators. For example,
39    * the JDBC source generator will use this to store the complex
40    * types table name here.</p>
41    */

42   public void setProperty(String JavaDoc pName, Object JavaDoc pValue);
43
44   /** <p>A property allows to store custom data related to the type.
45    * Properties are used by external source generators. For example,
46    * the JDBC source generator will use this to store the complex
47    * types table name here.</p>
48    */

49   public Object JavaDoc getProperty(String JavaDoc pName);
50
51   /** <p>Returns whether this is a global type.</p>
52    */

53   public boolean isGlobalType();
54
55   /** <p>Returns whether this type is generated with a global class.</p>
56    */

57   public boolean isGlobalClass();
58
59   /** <p>If the type is global: Returns the types name.</p>
60    * @throws IllegalStateException The type isn't global.
61    */

62   public XsQName getName();
63
64   /** <p>Returns whether the type is complex. If so, it is valid to
65    * invoke the method {@link #getComplexTypeSG}. Otherwise, you may
66    * invoke the method {@link #getSimpleTypeSG}.</p>
67    */

68   public boolean isComplex();
69
70   /** <p>If the type is simple: Creates a new instance of
71    * {@link org.apache.ws.jaxme.generator.sg.SimpleTypeSGChain} generating the type.</p>
72    * <p><em>Implementation note</em>: The type
73    * {@link org.apache.ws.jaxme.generator.sg.SimpleTypeSGChain}
74    * must not be exposed in the interface, because the interface
75    * class is used to generate this type. In other words, this
76    * interface must be compilable without the
77    * {@link org.apache.ws.jaxme.generator.sg.SimpleTypeSGChain}
78    * interface.</p>
79    */

80   public Object JavaDoc newSimpleTypeSG() throws SAXException JavaDoc;
81
82   /** <p>If the type is complex: Creates an instance of
83    * {@link org.apache.ws.jaxme.generator.sg.ComplexTypeSGChain} generating the type.</p>
84    * <p><em>Implementation note</em>: The type
85    * {@link org.apache.ws.jaxme.generator.sg.ComplexTypeSGChain}
86    * must not be exposed in the interface, because the interface
87    * class is used to generate this type. In other words, this
88    * interface must be compilable without the
89    * {@link org.apache.ws.jaxme.generator.sg.ComplexTypeSGChain}
90    * interface.</p>
91    */

92   public Object JavaDoc newComplexTypeSG() throws SAXException JavaDoc;
93
94   /** <p>If the type is complex: Returns an instance of
95    * {@link ComplexTypeSG} generating the type.</p>
96    */

97   public ComplexTypeSG getComplexTypeSG();
98
99   /** <p>If the type is simple: Returns an instance of {@link SimpleTypeSG}
100    * for generating the type.</p>
101    *
102    * @throws IllegalStateException The type is complex.
103    */

104   public SimpleTypeSG getSimpleTypeSG();
105
106   /** <p>Generates a Java field for an instance of this type.</p>
107    */

108   public JavaField getXMLField(JavaSource pSource,
109                                      String JavaDoc pFieldName, String JavaDoc pDefaultValue) throws SAXException JavaDoc;
110
111   /** <p>Generates a get method returning an instance of this type.</p>
112    */

113   public JavaMethod getXMLGetMethod(JavaSource pSource,
114                                      String JavaDoc pFieldName, String JavaDoc pMethodName) throws SAXException JavaDoc;
115
116   /** <p>Generates a set method returning an instance of this type.</p>
117    */

118   public JavaMethod getXMLSetMethod(JavaSource pSource, String JavaDoc pFieldName,
119                                     String JavaDoc pParamName,
120                                     String JavaDoc pMethodName, boolean pSetIsSet) throws SAXException JavaDoc;
121
122   /** <p>Generates an "isSet" method returning whether the field is set.</p>
123    */

124   public JavaMethod getXMLIsSetMethod(JavaSource pSource,
125                                        String JavaDoc pFieldName, String JavaDoc pMethodName) throws SAXException JavaDoc;
126
127   /** <p>Returns the types runtime type.</p>
128    */

129   public JavaQName getRuntimeType() throws SAXException JavaDoc;
130
131   /** <p>Generates the types sources.</p>
132    */

133   public void generate() throws SAXException JavaDoc;
134
135   /** <p>Generates the types sources as an inner class of the given.</p>
136    */

137   public void generate(JavaSource pSource) throws SAXException JavaDoc;
138
139   /** <p>Returns whether the type is a restriction of another type.</p>
140    */

141   public boolean isRestriction();
142
143   /** <p>If the type is a restriction: Returns the restricted type.</p>
144    * @throws IllegalStateException The type is no restriction.
145    */

146   public TypeSG getRestrictedType();
147
148   /** <p>Returns whether the type is an extension of another type.</p>
149    */

150   public boolean isExtension();
151
152   /** <p>If the type is an extension: Returns the extended type.</p>
153   * @throws IllegalStateException The type is no extension.
154    */

155   public TypeSG getExtendedType();
156
157   /** <p>Returns information on the types syntactical context.</p>
158    */

159   public XsSchemaHeader getSchemaHeader();
160 }
161
Popular Tags