DefinitionKind.java revision 608:7e06bf1dcb09
1/*
2 * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.  Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26/*
27 * File: ./org/omg/CORBA/DefinitionKind.java
28 * From: ./ir.idl
29 * Date: Fri Aug 28 16:03:31 1998
30 *   By: idltojava Java IDL 1.2 Aug 11 1998 02:00:18
31 */
32
33package org.omg.CORBA;
34
35/**
36* The class that provides the constants used to identify the type of an
37* Interface Repository object.  This class contains two kinds of constants,
38* those that are an <code>int</code> and those that are an instance of the class
39* <code>DefinitionKind</code>.  This class provides the method
40* <code>from_int</code>, which given one
41* of the <code>int</code> constants, creates the corresponding
42* <code>DefinitionKind</code> instance.  It also provides the method
43* <code>value</code>, which returns the <code>int</code> constant that
44* is the value for a <code>DefinitionKind</code> instance.
45*
46* @see IRObject
47*/
48
49public class DefinitionKind implements org.omg.CORBA.portable.IDLEntity {
50
51/**
52 * The constant that indicates that an Interface Repository object
53 * does not have a definition kind.
54 */
55        public static final int _dk_none = 0,
56
57/**
58 * The constant that indicates that the type of an Interface Repository object
59 * may be any type.
60 */
61        _dk_all = 1,
62
63/**
64 * The constant that indicates that an Interface Repository object is an
65 * attribute.
66 */
67        _dk_Attribute = 2,
68
69/**
70 * The constant that indicates that an Interface Repository object is a
71 * constant.
72 */
73        _dk_Constant = 3,
74
75/**
76 * The constant that indicates that an Interface Repository object is an
77 * exception.
78 */
79
80        _dk_Exception = 4,
81
82/**
83 * The constant that indicates that an Interface Repository object is an
84 * interface.
85 */
86
87        _dk_Interface = 5,
88
89/**
90 * The constant that indicates that an Interface Repository object is a
91 * module.
92 */
93
94        _dk_Module = 6,
95
96/**
97 * The constant that indicates that an Interface Repository object is an
98 * operation.
99 */
100
101        _dk_Operation = 7,
102
103/**
104 * The constant that indicates that an Interface Repository object is a
105 * Typedef.
106 */
107
108        _dk_Typedef = 8,
109
110/**
111 * The constant that indicates that an Interface Repository object is an
112 * Alias.
113 */
114
115        _dk_Alias = 9,
116
117/**
118 * The constant that indicates that an Interface Repository object is a
119 * Struct.
120 */
121
122        _dk_Struct = 10,
123
124/**
125 * The constant that indicates that an Interface Repository object is a
126 * Union.
127 */
128
129        _dk_Union = 11,
130
131/**
132 * The constant that indicates that an Interface Repository object is an
133 * Enum.
134 */
135
136        _dk_Enum = 12,
137
138/**
139 * The constant that indicates that an Interface Repository object is a
140 * Primitive.
141 */
142
143        _dk_Primitive = 13,
144
145/**
146 * The constant that indicates that an Interface Repository object is a
147 * String.
148 */
149
150        _dk_String = 14,
151
152/**
153 * The constant that indicates that an Interface Repository object is a
154 * Sequence.
155 */
156
157        _dk_Sequence = 15,
158
159/**
160 * The constant that indicates that an Interface Repository object is an
161 * Array.
162 */
163
164        _dk_Array = 16,
165
166/**
167 * The constant that indicates that an Interface Repository object is a
168 * Repository.
169 */
170
171        _dk_Repository = 17,
172
173/**
174 * The constant that indicates that an Interface Repository object is a
175 * Wstring.
176 */
177
178        _dk_Wstring = 18,
179
180/**
181 * The constant that indicates that an Interface Repository object is of type
182 * Fixed.
183 */
184
185        _dk_Fixed = 19,
186
187/**
188 * The constant that indicates that an Interface Repository object is a
189 * Value.
190 */
191
192        _dk_Value = 20,
193
194/**
195 * The constant that indicates that an Interface Repository object is a
196 * ValueBox.
197 */
198
199        _dk_ValueBox = 21,
200
201/**
202 * The constant that indicates that an Interface Repository object is a
203 * ValueMember.
204 */
205
206        _dk_ValueMember = 22,
207
208/**
209 * The constant that indicates that an Interface Repository object is of type
210 * Native.
211 */
212
213        _dk_Native = 23,
214
215/**
216 * The constant that indicates that an Interface Repository object
217 * is representing an abstract interface.
218 */
219        _dk_AbstractInterface = 24;
220
221/**
222 * The static instance of <code>DefinitionKind</code> indicating that an
223 * Interface Repository object has no definition kind.
224 */
225
226    public static final DefinitionKind dk_none = new DefinitionKind(_dk_none);
227
228     /**
229         * The wildcard <code>DefinitionKind</code> constant, useful
230         * in all occasions where any
231     * <code>DefinitionKind</code> is appropriate. The Container's
232         * <code>contents</code> method
233     * makes use of this constant to return all contained definitions of any kind.
234         */
235
236    public static final DefinitionKind dk_all = new DefinitionKind(_dk_all);
237
238/**
239 * The static instance of <code>DefinitionKind</code> indicating that an
240 * Interface Repository object is an Attribute.
241 */
242
243    public static final DefinitionKind dk_Attribute = new DefinitionKind(_dk_Attribute);
244
245/**
246 * The static instance of <code>DefinitionKind</code> indicating that an
247 * Interface Repository object is a constant.
248 */
249
250    public static final DefinitionKind dk_Constant = new DefinitionKind(_dk_Constant);
251
252
253/**
254 * The static instance of <code>DefinitionKind</code> indicating that an
255 * Interface Repository object is an Exception.
256 */
257
258    public static final DefinitionKind dk_Exception = new DefinitionKind(_dk_Exception);
259
260/**
261 * The static instance of <code>DefinitionKind</code> indicating that an
262 * Interface Repository object is an Interface.
263 */
264
265    public static final DefinitionKind dk_Interface = new DefinitionKind(_dk_Interface);
266
267/**
268 * The static instance of <code>DefinitionKind</code> indicating that an
269 * Interface Repository object is a Module.
270 */
271
272    public static final DefinitionKind dk_Module = new DefinitionKind(_dk_Module);
273
274/**
275 * The static instance of <code>DefinitionKind</code> indicating that an
276 * Interface Repository object is an Operation.
277 */
278
279    public static final DefinitionKind dk_Operation = new DefinitionKind(_dk_Operation);
280
281/**
282 * The static instance of <code>DefinitionKind</code> indicating that an
283 * Interface Repository object is a Typedef.
284 */
285
286    public static final DefinitionKind dk_Typedef = new DefinitionKind(_dk_Typedef);
287
288/**
289 * The static instance of <code>DefinitionKind</code> indicating that an
290 * Interface Repository object is an Alias.
291 */
292
293    public static final DefinitionKind dk_Alias = new DefinitionKind(_dk_Alias);
294
295/**
296 * The static instance of <code>DefinitionKind</code> indicating that an
297 * Interface Repository object is a Struct.
298 */
299
300    public static final DefinitionKind dk_Struct = new DefinitionKind(_dk_Struct);
301
302/**
303 * The static instance of <code>DefinitionKind</code> indicating that an
304 * Interface Repository object is a Union.
305 */
306
307    public static final DefinitionKind dk_Union = new DefinitionKind(_dk_Union);
308
309/**
310 * The static instance of <code>DefinitionKind</code> indicating that an
311 * Interface Repository object is an Enum.
312 */
313
314    public static final DefinitionKind dk_Enum = new DefinitionKind(_dk_Enum);
315
316/**
317 * The static instance of <code>DefinitionKind</code> indicating that an
318 * Interface Repository object is a Primitive.
319 */
320
321    public static final DefinitionKind dk_Primitive = new DefinitionKind(_dk_Primitive);
322
323/**
324 * The static instance of <code>DefinitionKind</code> indicating that an
325 * Interface Repository object is a String.
326 */
327
328    public static final DefinitionKind dk_String = new DefinitionKind(_dk_String);
329
330/**
331 * The static instance of <code>DefinitionKind</code> indicating that an
332 * Interface Repository object is a Sequence.
333 */
334
335    public static final DefinitionKind dk_Sequence = new DefinitionKind(_dk_Sequence);
336
337/**
338 * The static instance of <code>DefinitionKind</code> indicating that an
339 * Interface Repository object is an Array.
340 */
341
342    public static final DefinitionKind dk_Array = new DefinitionKind(_dk_Array);
343
344
345/**
346 * The static instance of <code>DefinitionKind</code> indicating that an
347 * Interface Repository object is a Repository.
348 */
349
350    public static final DefinitionKind dk_Repository = new DefinitionKind(_dk_Repository);
351
352
353/**
354 * The static instance of <code>DefinitionKind</code> indicating that an
355 * Interface Repository object is a Wstring.
356 */
357
358    public static final DefinitionKind dk_Wstring = new DefinitionKind(_dk_Wstring);
359
360/**
361 * The static instance of <code>DefinitionKind</code> indicating that an
362 * Interface Repository object is a Fixed value.
363 */
364
365    public static final DefinitionKind dk_Fixed = new DefinitionKind(_dk_Fixed);
366
367/**
368 * The static instance of <code>DefinitionKind</code> indicating that an
369 * Interface Repository object is a Value.
370 */
371
372    public static final DefinitionKind dk_Value = new DefinitionKind(_dk_Value);
373
374/**
375 * The static instance of <code>DefinitionKind</code> indicating that an
376 * Interface Repository object is a ValueBox.
377 */
378
379    public static final DefinitionKind dk_ValueBox = new DefinitionKind(_dk_ValueBox);
380
381/**
382 * The static instance of <code>DefinitionKind</code> indicating that an
383 * Interface Repository object is a ValueMember.
384 */
385
386    public static final DefinitionKind dk_ValueMember = new DefinitionKind(_dk_ValueMember);
387
388
389/**
390 * The static instance of <code>DefinitionKind</code> indicating that an
391 * Interface Repository object is a Native value.
392 */
393
394    public static final DefinitionKind dk_Native = new DefinitionKind(_dk_Native);
395
396
397/**
398* The static instance of <code>DefinitionKind</code> indicating that an
399* Interface Repository object represents an abstract interface.
400*/
401    public static final DefinitionKind dk_AbstractInterface = new DefinitionKind(_dk_AbstractInterface);
402
403
404     /**
405     * Returns the <code>int</code> constant identifying the type of an IR object.
406     * @return the <code>int</code> constant from the class
407         * <code>DefinitionKind</code> that is the value of this
408         * <code>DefinitionKind</code> instance
409     */
410
411    public int value() {
412        return _value;
413    }
414
415
416     /**
417     * Creates a <code>DefinitionKind</code> instance corresponding to the given code
418.
419     * @param i one of the <code>int</code> constants from the class
420         * <code>DefinitionKind</code>
421         * @return the <code>DefinitionKind</code> instance corresponding
422         *         to the given code
423         * @throws org.omg.CORBA.BAD_PARAM if the given parameter is not
424 one
425         *         of the <code>int</code> constants from the class
426         *         <code>DefinitionKind</code>
427     */
428
429    public static DefinitionKind from_int(int i) {
430        switch (i) {
431        case _dk_none:
432            return dk_none;
433        case _dk_all:
434            return dk_all;
435        case _dk_Attribute:
436            return dk_Attribute;
437        case _dk_Constant:
438            return dk_Constant;
439        case _dk_Exception:
440            return dk_Exception;
441        case _dk_Interface:
442            return dk_Interface;
443        case _dk_Module:
444            return dk_Module;
445        case _dk_Operation:
446            return dk_Operation;
447        case _dk_Typedef:
448            return dk_Typedef;
449        case _dk_Alias:
450            return dk_Alias;
451        case _dk_Struct:
452            return dk_Struct;
453        case _dk_Union:
454            return dk_Union;
455        case _dk_Enum:
456            return dk_Enum;
457        case _dk_Primitive:
458            return dk_Primitive;
459        case _dk_String:
460            return dk_String;
461        case _dk_Sequence:
462            return dk_Sequence;
463        case _dk_Array:
464            return dk_Array;
465        case _dk_Repository:
466            return dk_Repository;
467        case _dk_Wstring:
468            return dk_Wstring;
469        case _dk_Fixed:
470            return dk_Fixed;
471        case _dk_Value:
472            return dk_Value;
473        case _dk_ValueBox:
474            return dk_ValueBox;
475        case _dk_ValueMember:
476            return dk_ValueMember;
477        case _dk_Native:
478            return dk_Native;
479        default:
480            throw new org.omg.CORBA.BAD_PARAM();
481        }
482    }
483
484   /**
485    * Constructs a <code>DefinitionKind</code> object with its <code>_value</code>
486    * field initialized with the given value.
487    * @param _value one of the <code>int</code> constants defined in the
488    *                   class <code>DefinitionKind</code>
489    */
490
491    protected DefinitionKind(int _value){
492        this._value = _value;
493    }
494
495     /**
496      * The field that holds a value for a <code>DefinitionKind</code> object.
497      * @serial
498      */
499
500    private int _value;
501}
502