001: /*
002: * Copyright 1997-2004 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025:
026: package org.omg.CORBA;
027:
028: /**
029: * The Java mapping of the IDL enum <code>TCKind</code>, which
030: * specifies the kind of a <code>TypeCode</code> object. There is
031: * one kind for each primitive and essential IDL data type.
032: * <P>
033: * The class <code>TCKind</code> consists of:
034: * <UL>
035: * <LI>a set of <code>int</code> constants, one for each
036: * kind of IDL data type. These <code>int</code> constants
037: * make it possible to use a <code>switch</code> statement.
038: * <LI>a set of <code>TCKind</code> constants, one for each
039: * kind of IDL data type. The <code>value</code> field for
040: * each <code>TCKind</code> instance is initialized with
041: * the <code>int</code> constant that corresponds with
042: * the IDL data type that the instance represents.
043: * <LI>the method <code>from_int</code>for converting
044: * an <code>int</code> to its
045: * corresponding <code>TCKind</code> instance
046: * <P>Example:
047: * <PRE>
048: * org.omg.CORBA.TCKind k = org.omg.CORBA.TCKind.from_int(
049: * org.omg.CORBA.TCKind._tk_string);
050: * </PRE>
051: * The variable <code>k</code> represents the <code>TCKind</code>
052: * instance for the IDL type <code>string</code>, which is
053: * <code>tk_string</code>.
054: * <P>
055: * <LI>the method <code>value</code> for accessing the
056: * <code>_value</code> field of a <code>TCKind</code> constant
057: * <P>Example:
058: * <PRE>
059: * int i = org.omg.CORBA.TCKind.tk_char.value();
060: * </PRE>
061: * The variable <code>i</code> represents 9, the value for the
062: * IDL data type <code>char</code>.
063: * </UL>
064: * <P>The <code>value</code> field of a <code>TCKind</code> instance
065: * is the CDR encoding used for a <code>TypeCode</code> object in
066: * an IIOP message.
067: */
068:
069: public class TCKind {
070:
071: /**
072: * The <code>int</code> constant for a <code>null</code> IDL data type.
073: */
074: public static final int _tk_null = 0;
075:
076: /**
077: * The <code>int</code> constant for the IDL data type <code>void</code>.
078: */
079: public static final int _tk_void = 1;
080:
081: /**
082: * The <code>int</code> constant for the IDL data type <code>short</code>.
083: */
084: public static final int _tk_short = 2;
085:
086: /**
087: * The <code>int</code> constant for the IDL data type <code>long</code>.
088: */
089: public static final int _tk_long = 3;
090:
091: /**
092: * The <code>int</code> constant for the IDL data type <code>ushort</code>.
093: */
094: public static final int _tk_ushort = 4;
095:
096: /**
097: * The <code>int</code> constant for the IDL data type <code>ulong</code>.
098: */
099: public static final int _tk_ulong = 5;
100:
101: /**
102: * The <code>int</code> constant for the IDL data type <code>float</code>.
103: */
104: public static final int _tk_float = 6;
105:
106: /**
107: * The <code>int</code> constant for the IDL data type <code>double</code>.
108: */
109: public static final int _tk_double = 7;
110:
111: /**
112: * The <code>int</code> constant for the IDL data type <code>boolean</code>.
113: */
114: public static final int _tk_boolean = 8;
115:
116: /**
117: * The <code>int</code> constant for the IDL data type <code>char</code>.
118: */
119: public static final int _tk_char = 9;
120:
121: /**
122: * The <code>int</code> constant for the IDL data type <code>octet</code>.
123: */
124: public static final int _tk_octet = 10;
125:
126: /**
127: * The <code>int</code> constant for the IDL data type <code>any</code>.
128: */
129: public static final int _tk_any = 11;
130:
131: /**
132: * The <code>int</code> constant for the IDL data type <code>TypeCode</code>.
133: */
134: public static final int _tk_TypeCode = 12;
135:
136: /**
137: * The <code>int</code> constant for the IDL data type <code>Principal</code>.
138: */
139: public static final int _tk_Principal = 13;
140:
141: /**
142: * The <code>int</code> constant for the IDL data type <code>objref</code>.
143: */
144: public static final int _tk_objref = 14;
145:
146: /**
147: * The <code>int</code> constant for the IDL data type <code>struct</code>.
148: */
149: public static final int _tk_struct = 15;
150:
151: /**
152: * The <code>int</code> constant for the IDL data type <code>union</code>.
153: */
154: public static final int _tk_union = 16;
155:
156: /**
157: * The <code>int</code> constant for the IDL data type <code>enum</code>.
158: */
159: public static final int _tk_enum = 17;
160:
161: /**
162: * The <code>int</code> constant for the IDL data type <code>string</code>.
163: */
164: public static final int _tk_string = 18;
165:
166: /**
167: * The <code>int</code> constant for the IDL data type <code>sequence</code>.
168: */
169: public static final int _tk_sequence = 19;
170:
171: /**
172: * The <code>int</code> constant for the IDL data type <code>array</code>.
173: */
174: public static final int _tk_array = 20;
175:
176: /**
177: * The <code>int</code> constant for the IDL data type <code>alias</code>.
178: */
179: public static final int _tk_alias = 21;
180:
181: /**
182: * The <code>int</code> constant for the IDL data type <code>except</code>.
183: */
184: public static final int _tk_except = 22;
185:
186: /**
187: * The <code>int</code> constant for the IDL data type <code>longlong</code>.
188: */
189: public static final int _tk_longlong = 23;
190:
191: /**
192: * The <code>int</code> constant for the IDL data type <code>ulonglong</code>.
193: */
194: public static final int _tk_ulonglong = 24;
195:
196: /**
197: * The <code>int</code> constant for the IDL data type <code>longdouble</code>.
198: */
199: public static final int _tk_longdouble = 25;
200:
201: /**
202: * The <code>int</code> constant for the IDL data type <code>wchar</code>.
203: */
204: public static final int _tk_wchar = 26;
205:
206: /**
207: * The <code>int</code> constant for the IDL data type <code>wstring</code>.
208: */
209: public static final int _tk_wstring = 27;
210:
211: /**
212: * The <code>int</code> constant for the IDL data type <code>fixed</code>.
213: */
214: public static final int _tk_fixed = 28;
215:
216: /**
217: * The <code>int</code> constant for the IDL data type <code>value</code>.
218: */
219: public static final int _tk_value = 29; // orbos 98-01-18: Objects By Value
220:
221: /**
222: * The <code>int</code> constant for the IDL data type <code>value_box</code>.
223: */
224: public static final int _tk_value_box = 30; // orbos 98-01-18: Objects By Value
225:
226: /**
227: * The <code>int</code> constant for the IDL data type <code>native</code>.
228: */
229: public static final int _tk_native = 31; // Verify
230:
231: /**
232: * The <code>int</code> constant for the IDL data type <code>abstract interface</code>.
233: */
234: public static final int _tk_abstract_interface = 32;
235:
236: /**
237: * The <code>TCKind</code> constant whose <code>value</code> field is
238: * initialized with <code>TCKind._tk_null</code>.
239: */
240: public static final TCKind tk_null = new TCKind(_tk_null);
241:
242: /**
243: * The <code>TCKind</code> constant whose <code>value</code> field is
244: * initialized with <code>TCKind._tk_void</code>.
245: */
246: public static final TCKind tk_void = new TCKind(_tk_void);
247:
248: /**
249: * The <code>TCKind</code> constant whose <code>value</code> field is
250: * initialized with <code>TCKind._tk_short</code>.
251: */
252: public static final TCKind tk_short = new TCKind(_tk_short);
253:
254: /**
255: * The <code>TCKind</code> constant whose <code>value</code> field is
256: * initialized with <code>TCKind._tk_long</code>.
257: */
258: public static final TCKind tk_long = new TCKind(_tk_long);
259:
260: /**
261: * The <code>TCKind</code> constant whose <code>value</code> field is
262: * initialized with <code>TCKind._tk_ushort</code>.
263: */
264: public static final TCKind tk_ushort = new TCKind(_tk_ushort);
265:
266: /**
267: * The <code>TCKind</code> constant whose <code>value</code> field is
268: * initialized with <code>TCKind._tk_ulong</code>.
269: */
270: public static final TCKind tk_ulong = new TCKind(_tk_ulong);
271:
272: /**
273: * The <code>TCKind</code> constant whose <code>value</code> field is
274: * initialized with <code>TCKind._tk_float</code>.
275: */
276: public static final TCKind tk_float = new TCKind(_tk_float);
277:
278: /**
279: * The <code>TCKind</code> constant whose <code>value</code> field is
280: * initialized with <code>TCKind._tk_double</code>.
281: */
282: public static final TCKind tk_double = new TCKind(_tk_double);
283:
284: /**
285: * The <code>TCKind</code> constant whose <code>value</code> field is
286: * initialized with <code>TCKind._tk_boolean</code>.
287: */
288: public static final TCKind tk_boolean = new TCKind(_tk_boolean);
289:
290: /**
291: * The <code>TCKind</code> constant whose <code>value</code> field is
292: * initialized with <code>TCKind._tk_char</code>.
293: */
294: public static final TCKind tk_char = new TCKind(_tk_char);
295:
296: /**
297: * The <code>TCKind</code> constant whose <code>value</code> field is
298: * initialized with <code>TCKind._tk_octet</code>.
299: */
300: public static final TCKind tk_octet = new TCKind(_tk_octet);
301:
302: /**
303: * The <code>TCKind</code> constant whose <code>value</code> field is
304: * initialized with <code>TCKind._tk_any</code>.
305: */
306: public static final TCKind tk_any = new TCKind(_tk_any);
307:
308: /**
309: * The <code>TCKind</code> constant whose <code>value</code> field is
310: * initialized with <code>TCKind._tk_TypeCode</code>.
311: */
312: public static final TCKind tk_TypeCode = new TCKind(_tk_TypeCode);
313:
314: /**
315: * The <code>TCKind</code> constant whose <code>value</code> field is
316: * initialized with <code>TCKind._tk_Principal</code>.
317: */
318: public static final TCKind tk_Principal = new TCKind(_tk_Principal);
319:
320: /**
321: * The <code>TCKind</code> constant whose <code>value</code> field is
322: * initialized with <code>TCKind._tk_objref</code>.
323: */
324: public static final TCKind tk_objref = new TCKind(_tk_objref);
325:
326: /**
327: * The <code>TCKind</code> constant whose <code>value</code> field is
328: * initialized with <code>TCKind._tk_struct</code>.
329: */
330: public static final TCKind tk_struct = new TCKind(_tk_struct);
331:
332: /**
333: * The <code>TCKind</code> constant whose <code>value</code> field is
334: * initialized with <code>TCKind._tk_union</code>.
335: */
336: public static final TCKind tk_union = new TCKind(_tk_union);
337:
338: /**
339: * The <code>TCKind</code> constant whose <code>value</code> field is
340: * initialized with <code>TCKind._tk_enum</code>.
341: */
342: public static final TCKind tk_enum = new TCKind(_tk_enum);
343:
344: /**
345: * The <code>TCKind</code> constant whose <code>value</code> field is
346: * initialized with <code>TCKind._tk_string</code>.
347: */
348: public static final TCKind tk_string = new TCKind(_tk_string);
349:
350: /**
351: * The <code>TCKind</code> constant whose <code>value</code> field is
352: * initialized with <code>TCKind._tk_sequence</code>.
353: */
354: public static final TCKind tk_sequence = new TCKind(_tk_sequence);
355:
356: /**
357: * The <code>TCKind</code> constant whose <code>value</code> field is
358: * initialized with <code>TCKind._tk_array</code>.
359: */
360: public static final TCKind tk_array = new TCKind(_tk_array);
361:
362: /**
363: * The <code>TCKind</code> constant whose <code>value</code> field is
364: * initialized with <code>TCKind._tk_alias</code>.
365: */
366: public static final TCKind tk_alias = new TCKind(_tk_alias);
367:
368: /**
369: * The <code>TCKind</code> constant whose <code>value</code> field is
370: * initialized with <code>TCKind._tk_except</code>.
371: */
372: public static final TCKind tk_except = new TCKind(_tk_except);
373:
374: /**
375: * The <code>TCKind</code> constant whose <code>value</code> field is
376: * initialized with <code>TCKind._tk_longlong</code>.
377: */
378: public static final TCKind tk_longlong = new TCKind(_tk_longlong);
379:
380: /**
381: * The <code>TCKind</code> constant whose <code>value</code> field is
382: * initialized with <code>TCKind._tk_ulonglong</code>.
383: */
384: public static final TCKind tk_ulonglong = new TCKind(_tk_ulonglong);
385:
386: /**
387: * The <code>TCKind</code> constant whose <code>value</code> field is
388: * initialized with <code>TCKind._tk_longdouble</code>.
389: */
390: public static final TCKind tk_longdouble = new TCKind(
391: _tk_longdouble);
392:
393: /**
394: * The <code>TCKind</code> constant whose <code>value</code> field is
395: * initialized with <code>TCKind._tk_wchar</code>.
396: */
397: public static final TCKind tk_wchar = new TCKind(_tk_wchar);
398:
399: /**
400: * The <code>TCKind</code> constant whose <code>value</code> field is
401: * initialized with <code>TCKind._tk_wstring</code>.
402: */
403: public static final TCKind tk_wstring = new TCKind(_tk_wstring);
404:
405: /**
406: * The <code>TCKind</code> constant whose <code>value</code> field is
407: * initialized with <code>TCKind._tk_fixed</code>.
408: */
409: public static final TCKind tk_fixed = new TCKind(_tk_fixed);
410:
411: // orbos 98-01-18: Objects By Value -- begin
412:
413: /**
414: * The <code>TCKind</code> constant whose <code>value</code> field is
415: * initialized with <code>TCKind._tk_value</code>.
416: */
417: public static final TCKind tk_value = new TCKind(_tk_value);
418:
419: /**
420: * The <code>TCKind</code> constant whose <code>value</code> field is
421: * initialized with <code>TCKind._tk_value_box</code>.
422: */
423: public static final TCKind tk_value_box = new TCKind(_tk_value_box);
424: // orbos 98-01-18: Objects By Value -- end
425:
426: /**
427: * The <code>TCKind</code> constant whose <code>value</code> field is
428: * initialized with <code>TCKind._tk_native</code>.
429: */
430: public static final TCKind tk_native = new TCKind(_tk_native);
431:
432: /**
433: * The <code>TCKind</code> constant whose <code>value</code> field is
434: * initialized with <code>TCKind._tk_abstract_interface</code>.
435: */
436: public static final TCKind tk_abstract_interface = new TCKind(
437: _tk_abstract_interface);
438:
439: /**
440: * Retrieves the value of this <code>TCKind</code> instance.
441: *
442: * @return the <code>int</code> that represents the kind of
443: * IDL data type for this <code>TCKind</code> instance
444: */
445: public int value() {
446: return _value;
447: }
448:
449: /**
450: * Converts the given <code>int</code> to the corresponding
451: * <code>TCKind</code> instance.
452: *
453: * @param i the <code>int</code> to convert. It must be one of
454: * the <code>int</code> constants in the class
455: * <code>TCKind</code>.
456: * @return the <code>TCKind</code> instance whose <code>value</code>
457: * field matches the given <code>int</code>
458: * @exception BAD_PARAM if the given <code>int</code> does not
459: * match the <code>_value</code> field of
460: * any <code>TCKind</code> instance
461: */
462: public static TCKind from_int(int i) {
463: switch (i) {
464: case _tk_null:
465: return tk_null;
466: case _tk_void:
467: return tk_void;
468: case _tk_short:
469: return tk_short;
470: case _tk_long:
471: return tk_long;
472: case _tk_ushort:
473: return tk_ushort;
474: case _tk_ulong:
475: return tk_ulong;
476: case _tk_float:
477: return tk_float;
478: case _tk_double:
479: return tk_double;
480: case _tk_boolean:
481: return tk_boolean;
482: case _tk_char:
483: return tk_char;
484: case _tk_octet:
485: return tk_octet;
486: case _tk_any:
487: return tk_any;
488: case _tk_TypeCode:
489: return tk_TypeCode;
490: case _tk_Principal:
491: return tk_Principal;
492: case _tk_objref:
493: return tk_objref;
494: case _tk_struct:
495: return tk_struct;
496: case _tk_union:
497: return tk_union;
498: case _tk_enum:
499: return tk_enum;
500: case _tk_string:
501: return tk_string;
502: case _tk_sequence:
503: return tk_sequence;
504: case _tk_array:
505: return tk_array;
506: case _tk_alias:
507: return tk_alias;
508: case _tk_except:
509: return tk_except;
510: case _tk_longlong:
511: return tk_longlong;
512: case _tk_ulonglong:
513: return tk_ulonglong;
514: case _tk_longdouble:
515: return tk_longdouble;
516: case _tk_wchar:
517: return tk_wchar;
518: case _tk_wstring:
519: return tk_wstring;
520: case _tk_fixed:
521: return tk_fixed;
522: case _tk_value: // orbos 98-01-18: Objects By Value
523: return tk_value;
524: case _tk_value_box: // orbos 98-01-18: Objects By Value
525: return tk_value_box;
526: case _tk_native:
527: return tk_native;
528: case _tk_abstract_interface:
529: return tk_abstract_interface;
530: default:
531: throw new org.omg.CORBA.BAD_PARAM();
532: }
533: }
534:
535: /**
536: * Creates a new <code>TCKind</code> instance initialized with the given
537: * <code>int</code>.
538: * @deprecated Do not use this constructor as this method should be private
539: * according to the OMG specification. Use {@link #from_int(int)} instead.
540: *
541: * @param _value the <code>int</code> to convert. It must be one of
542: * the <code>int</code> constants in the class
543: * <code>TCKind</code>.
544: * @return a new <code>TCKind</code> instance whose <code>value</code>
545: * field matches the given <code>int</code>
546: */
547: @Deprecated
548: protected TCKind(int _value) {
549: this ._value = _value;
550: }
551:
552: private int _value;
553: }
|