1. /*
  2. * @(#)TCKind.java 1.21 00/02/02
  3. *
  4. * Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package org.omg.CORBA;
  11. /**
  12. * The Java mapping of the IDL enum <code>TCKind</code>, which
  13. * specifies the kind of a <code>TypeCode</code> object. There is
  14. * one kind for each primitive and essential IDL datatype.
  15. * <P>
  16. * The class <code>TCKind</code> consists of:
  17. * <UL>
  18. * <LI>a set of <code>int</code> constants, one for each
  19. * kind of IDL data type. These <code>int</code> constants
  20. * make it possible to use a <code>switch</code> statement.
  21. * <LI>a set of <code>TCKind</code> constants, one for each
  22. * kind of IDL data type. The <code>value</code> field for
  23. * each <code>TCKind</code> instance is initialized with
  24. * the <code>int</code> constant that corresponds with
  25. * the IDL data type that the instance represents.
  26. * <LI>the method <code>from_int</code>for converting
  27. * an <code>int</code> to its
  28. * corresponding <code>TCKind</code> instance
  29. * <P>Example:
  30. * <PRE>
  31. * org.omg.CORBA.TCKind k = org.omg.CORBA.TCKind.from_int(
  32. * org.omg.CORBA.TCKind._tk_string);
  33. * </PRE>
  34. * The variable <code>k</code> represents the <code>TCKind</code>
  35. * instance for the IDL type <code>string</code>, which is
  36. * <code>tk_string</code>.
  37. * <P>
  38. * <LI>the method <code>value</code> for accessing the
  39. * <code>_value</code> field of a <code>TCKind</code> constant
  40. * <P>Example:
  41. * <PRE>
  42. * int i = org.omg.CORBA.TCKind.tk_char.value();
  43. * </PRE>
  44. * The variable <code>i</code> represents 9, the value for the
  45. * IDL data type <code>char</code>.
  46. * </UL>
  47. * <P>The <code>value</code> field of a <code>TCKind</code> instance
  48. * is the CDR encoding used for a <code>TypeCode</code> object in
  49. * an IIOP message.
  50. */
  51. public class TCKind {
  52. /**
  53. * The <code>int</code> constant for a <code>null</code> IDL data type.
  54. */
  55. public static final int _tk_null = 0;
  56. /**
  57. * The <code>int</code> constant for the IDL data type <code>void</code>.
  58. */
  59. public static final int _tk_void = 1;
  60. /**
  61. * The <code>int</code> constant for the IDL data type <code>short</code>.
  62. */
  63. public static final int _tk_short = 2;
  64. /**
  65. * The <code>int</code> constant for the IDL data type <code>long</code>.
  66. */
  67. public static final int _tk_long = 3;
  68. /**
  69. * The <code>int</code> constant for the IDL data type <code>ushort</code>.
  70. */
  71. public static final int _tk_ushort = 4;
  72. /**
  73. * The <code>int</code> constant for the IDL data type <code>ulong</code>.
  74. */
  75. public static final int _tk_ulong = 5;
  76. /**
  77. * The <code>int</code> constant for the IDL data type <code>float</code>.
  78. */
  79. public static final int _tk_float = 6;
  80. /**
  81. * The <code>int</code> constant for the IDL data type <code>double</code>.
  82. */
  83. public static final int _tk_double = 7;
  84. /**
  85. * The <code>int</code> constant for the IDL data type <code>boolean</code>.
  86. */
  87. public static final int _tk_boolean = 8;
  88. /**
  89. * The <code>int</code> constant for the IDL data type <code>char</code>.
  90. */
  91. public static final int _tk_char = 9;
  92. /**
  93. * The <code>int</code> constant for the IDL data type <code>octet</code>.
  94. */
  95. public static final int _tk_octet = 10;
  96. /**
  97. * The <code>int</code> constant for the IDL data type <code>any</code>.
  98. */
  99. public static final int _tk_any = 11;
  100. /**
  101. * The <code>int</code> constant for the IDL data type <code>TypeCode</code>.
  102. */
  103. public static final int _tk_TypeCode = 12;
  104. /**
  105. * The <code>int</code> constant for the IDL data type <code>Principal</code>.
  106. */
  107. public static final int _tk_Principal = 13;
  108. /**
  109. * The <code>int</code> constant for the IDL data type <code>objref</code>.
  110. */
  111. public static final int _tk_objref = 14;
  112. /**
  113. * The <code>int</code> constant for the IDL data type <code>struct</code>.
  114. */
  115. public static final int _tk_struct = 15;
  116. /**
  117. * The <code>int</code> constant for the IDL data type <code>union</code>.
  118. */
  119. public static final int _tk_union = 16;
  120. /**
  121. * The <code>int</code> constant for the IDL data type <code>enum</code>.
  122. */
  123. public static final int _tk_enum = 17;
  124. /**
  125. * The <code>int</code> constant for the IDL data type <code>string</code>.
  126. */
  127. public static final int _tk_string = 18;
  128. /**
  129. * The <code>int</code> constant for the IDL data type <code>sequence</code>.
  130. */
  131. public static final int _tk_sequence = 19;
  132. /**
  133. * The <code>int</code> constant for the IDL data type <code>array</code>.
  134. */
  135. public static final int _tk_array = 20;
  136. /**
  137. * The <code>int</code> constant for the IDL data type <code>alias</code>.
  138. */
  139. public static final int _tk_alias = 21;
  140. /**
  141. * The <code>int</code> constant for the IDL data type <code>except</code>.
  142. */
  143. public static final int _tk_except = 22;
  144. /**
  145. * The <code>int</code> constant for the IDL data type <code>longlong</code>.
  146. */
  147. public static final int _tk_longlong = 23;
  148. /**
  149. * The <code>int</code> constant for the IDL data type <code>ulonglong</code>.
  150. */
  151. public static final int _tk_ulonglong = 24;
  152. /**
  153. * The <code>int</code> constant for the IDL data type <code>longdouble</code>.
  154. */
  155. public static final int _tk_longdouble = 25;
  156. /**
  157. * The <code>int</code> constant for the IDL data type <code>wchar</code>.
  158. */
  159. public static final int _tk_wchar = 26;
  160. /**
  161. * The <code>int</code> constant for the IDL data type <code>wstring</code>.
  162. */
  163. public static final int _tk_wstring = 27;
  164. /**
  165. * The <code>int</code> constant for the IDL data type <code>fixed</code>.
  166. */
  167. public static final int _tk_fixed = 28;
  168. /**
  169. * The <code>int</code> constant for the IDL data type <code>value</code>.
  170. */
  171. public static final int _tk_value = 29; // orbos 98-01-18: Objects By Value
  172. /**
  173. * The <code>int</code> constant for the IDL data type <code>value_box</code>.
  174. */
  175. public static final int _tk_value_box = 30; // orbos 98-01-18: Objects By Value
  176. /**
  177. * The <code>int</code> constant for the IDL data type <code>native</code>.
  178. */
  179. public static final int _tk_native = 31; // Verify
  180. /**
  181. * The <code>int</code> constant for the IDL data type <code>abstract interface</code>.
  182. */
  183. public static final int _tk_abstract_interface = 32;
  184. /**
  185. * The <code>TCKind</code> constant whose <code>value</code> field is
  186. * initialized with <code>TCKind._tk_null</code>.
  187. */
  188. public static final TCKind tk_null = new TCKind(_tk_null);
  189. /**
  190. * The <code>TCKind</code> constant whose <code>value</code> field is
  191. * initialized with <code>TCKind._tk_void</code>.
  192. */
  193. public static final TCKind tk_void = new TCKind(_tk_void);
  194. /**
  195. * The <code>TCKind</code> constant whose <code>value</code> field is
  196. * initialized with <code>TCKind._tk_short</code>.
  197. */
  198. public static final TCKind tk_short = new TCKind(_tk_short);
  199. /**
  200. * The <code>TCKind</code> constant whose <code>value</code> field is
  201. * initialized with <code>TCKind._tk_long</code>.
  202. */
  203. public static final TCKind tk_long = new TCKind(_tk_long);
  204. /**
  205. * The <code>TCKind</code> constant whose <code>value</code> field is
  206. * initialized with <code>TCKind._tk_ushort</code>.
  207. */
  208. public static final TCKind tk_ushort = new TCKind(_tk_ushort);
  209. /**
  210. * The <code>TCKind</code> constant whose <code>value</code> field is
  211. * initialized with <code>TCKind._tk_ulong</code>.
  212. */
  213. public static final TCKind tk_ulong = new TCKind(_tk_ulong);
  214. /**
  215. * The <code>TCKind</code> constant whose <code>value</code> field is
  216. * initialized with <code>TCKind._tk_float</code>.
  217. */
  218. public static final TCKind tk_float = new TCKind(_tk_float);
  219. /**
  220. * The <code>TCKind</code> constant whose <code>value</code> field is
  221. * initialized with <code>TCKind._tk_double</code>.
  222. */
  223. public static final TCKind tk_double = new TCKind(_tk_double);
  224. /**
  225. * The <code>TCKind</code> constant whose <code>value</code> field is
  226. * initialized with <code>TCKind._tk_boolean</code>.
  227. */
  228. public static final TCKind tk_boolean = new TCKind(_tk_boolean);
  229. /**
  230. * The <code>TCKind</code> constant whose <code>value</code> field is
  231. * initialized with <code>TCKind._tk_char</code>.
  232. */
  233. public static final TCKind tk_char = new TCKind(_tk_char);
  234. /**
  235. * The <code>TCKind</code> constant whose <code>value</code> field is
  236. * initialized with <code>TCKind._tk_octet</code>.
  237. */
  238. public static final TCKind tk_octet = new TCKind(_tk_octet);
  239. /**
  240. * The <code>TCKind</code> constant whose <code>value</code> field is
  241. * initialized with <code>TCKind._tk_any</code>.
  242. */
  243. public static final TCKind tk_any = new TCKind(_tk_any);
  244. /**
  245. * The <code>TCKind</code> constant whose <code>value</code> field is
  246. * initialized with <code>TCKind._tk_TypeCode</code>.
  247. */
  248. public static final TCKind tk_TypeCode = new TCKind(_tk_TypeCode);
  249. /**
  250. * The <code>TCKind</code> constant whose <code>value</code> field is
  251. * initialized with <code>TCKind._tk_Principal</code>.
  252. */
  253. public static final TCKind tk_Principal = new TCKind(_tk_Principal);
  254. /**
  255. * The <code>TCKind</code> constant whose <code>value</code> field is
  256. * initialized with <code>TCKind._tk_objref</code>.
  257. */
  258. public static final TCKind tk_objref = new TCKind(_tk_objref);
  259. /**
  260. * The <code>TCKind</code> constant whose <code>value</code> field is
  261. * initialized with <code>TCKind._tk_struct</code>.
  262. */
  263. public static final TCKind tk_struct = new TCKind(_tk_struct);
  264. /**
  265. * The <code>TCKind</code> constant whose <code>value</code> field is
  266. * initialized with <code>TCKind._tk_union</code>.
  267. */
  268. public static final TCKind tk_union = new TCKind(_tk_union);
  269. /**
  270. * The <code>TCKind</code> constant whose <code>value</code> field is
  271. * initialized with <code>TCKind._tk_enum</code>.
  272. */
  273. public static final TCKind tk_enum = new TCKind(_tk_enum);
  274. /**
  275. * The <code>TCKind</code> constant whose <code>value</code> field is
  276. * initialized with <code>TCKind._tk_string</code>.
  277. */
  278. public static final TCKind tk_string = new TCKind(_tk_string);
  279. /**
  280. * The <code>TCKind</code> constant whose <code>value</code> field is
  281. * initialized with <code>TCKind._tk_sequence</code>.
  282. */
  283. public static final TCKind tk_sequence = new TCKind(_tk_sequence);
  284. /**
  285. * The <code>TCKind</code> constant whose <code>value</code> field is
  286. * initialized with <code>TCKind._tk_array</code>.
  287. */
  288. public static final TCKind tk_array = new TCKind(_tk_array);
  289. /**
  290. * The <code>TCKind</code> constant whose <code>value</code> field is
  291. * initialized with <code>TCKind._tk_alias</code>.
  292. */
  293. public static final TCKind tk_alias = new TCKind(_tk_alias);
  294. /**
  295. * The <code>TCKind</code> constant whose <code>value</code> field is
  296. * initialized with <code>TCKind._tk_except</code>.
  297. */
  298. public static final TCKind tk_except = new TCKind(_tk_except);
  299. /**
  300. * The <code>TCKind</code> constant whose <code>value</code> field is
  301. * initialized with <code>TCKind._tk_longlong</code>.
  302. */
  303. public static final TCKind tk_longlong = new TCKind(_tk_longlong);
  304. /**
  305. * The <code>TCKind</code> constant whose <code>value</code> field is
  306. * initialized with <code>TCKind._tk_ulonglong</code>.
  307. */
  308. public static final TCKind tk_ulonglong = new TCKind(_tk_ulonglong);
  309. /**
  310. * The <code>TCKind</code> constant whose <code>value</code> field is
  311. * initialized with <code>TCKind._tk_longdouble</code>.
  312. */
  313. public static final TCKind tk_longdouble = new TCKind(_tk_longdouble);
  314. /**
  315. * The <code>TCKind</code> constant whose <code>value</code> field is
  316. * initialized with <code>TCKind._tk_wchar</code>.
  317. */
  318. public static final TCKind tk_wchar = new TCKind(_tk_wchar);
  319. /**
  320. * The <code>TCKind</code> constant whose <code>value</code> field is
  321. * initialized with <code>TCKind._tk_wstring</code>.
  322. */
  323. public static final TCKind tk_wstring = new TCKind(_tk_wstring);
  324. /**
  325. * The <code>TCKind</code> constant whose <code>value</code> field is
  326. * initialized with <code>TCKind._tk_fixed</code>.
  327. */
  328. public static final TCKind tk_fixed = new TCKind(_tk_fixed);
  329. // orbos 98-01-18: Objects By Value -- begin
  330. /**
  331. * The <code>TCKind</code> constant whose <code>value</code> field is
  332. * initialized with <code>TCKind._tk_value</code>.
  333. */
  334. public static final TCKind tk_value = new TCKind(_tk_value);
  335. /**
  336. * The <code>TCKind</code> constant whose <code>value</code> field is
  337. * initialized with <code>TCKind._tk_value_box</code>.
  338. */
  339. public static final TCKind tk_value_box = new TCKind(_tk_value_box);
  340. // orbos 98-01-18: Objects By Value -- end
  341. /**
  342. * The <code>TCKind</code> constant whose <code>value</code> field is
  343. * initialized with <code>TCKind._tk_native</code>.
  344. */
  345. public static final TCKind tk_native = new TCKind(_tk_native);
  346. /**
  347. * The <code>TCKind</code> constant whose <code>value</code> field is
  348. * initialized with <code>TCKind._tk_abstract_interface</code>.
  349. */
  350. public static final TCKind tk_abstract_interface = new TCKind(_tk_abstract_interface);
  351. /**
  352. * Retrieves the value of this <code>TCKind</code> instance.
  353. *
  354. * @return the <code>int</code> that represents the kind of
  355. * IDL data type for this <code>TCKind</code> instance
  356. */
  357. public int value() {
  358. return _value;
  359. }
  360. /**
  361. * Converts the given <code>int</code> to the corresponding
  362. * <code>TCKind</code> instance.
  363. *
  364. * @param the <code>int</code> to convert. It must be one of
  365. * the <code>int</code> constants in the class
  366. * <code>TCKind</code>.
  367. * @return the <code>TCKind</code> instance whose <code>value</code>
  368. * field matches the given <code>int</code>
  369. * @exception BAD_PARAM if the given <code>int</code> does not
  370. * match the <code>_value</code> field of
  371. * any <code>TCKind</code> instance
  372. */
  373. public static TCKind from_int(int i) throws org.omg.CORBA.BAD_PARAM {
  374. switch (i) {
  375. case _tk_null:
  376. return tk_null;
  377. case _tk_void:
  378. return tk_void;
  379. case _tk_short:
  380. return tk_short;
  381. case _tk_long:
  382. return tk_long;
  383. case _tk_ushort:
  384. return tk_ushort;
  385. case _tk_ulong:
  386. return tk_ulong;
  387. case _tk_float:
  388. return tk_float;
  389. case _tk_double:
  390. return tk_double;
  391. case _tk_boolean:
  392. return tk_boolean;
  393. case _tk_char:
  394. return tk_char;
  395. case _tk_octet:
  396. return tk_octet;
  397. case _tk_any:
  398. return tk_any;
  399. case _tk_TypeCode:
  400. return tk_TypeCode;
  401. case _tk_Principal:
  402. return tk_Principal;
  403. case _tk_objref:
  404. return tk_objref;
  405. case _tk_struct:
  406. return tk_struct;
  407. case _tk_union:
  408. return tk_union;
  409. case _tk_enum:
  410. return tk_enum;
  411. case _tk_string:
  412. return tk_string;
  413. case _tk_sequence:
  414. return tk_sequence;
  415. case _tk_array:
  416. return tk_array;
  417. case _tk_alias:
  418. return tk_alias;
  419. case _tk_except:
  420. return tk_except;
  421. case _tk_longlong:
  422. return tk_longlong;
  423. case _tk_ulonglong:
  424. return tk_ulonglong;
  425. case _tk_longdouble:
  426. return tk_longdouble;
  427. case _tk_wchar:
  428. return tk_wchar;
  429. case _tk_wstring:
  430. return tk_wstring;
  431. case _tk_fixed:
  432. return tk_fixed;
  433. case _tk_value: // orbos 98-01-18: Objects By Value
  434. return tk_value;
  435. case _tk_value_box: // orbos 98-01-18: Objects By Value
  436. return tk_value_box;
  437. case _tk_native:
  438. return tk_native;
  439. case _tk_abstract_interface:
  440. return tk_abstract_interface;
  441. default:
  442. throw new org.omg.CORBA.BAD_PARAM();
  443. }
  444. }
  445. /**
  446. * Creates a new <code>TCKind</code> instance initialized with the given
  447. * <code>int</code>.
  448. * @deprecated Do not use this constructor as this method should be private
  449. * according to the OMG specification. Use {@link #from_int(int)} instead.
  450. *
  451. * @param the <code>int</code> to convert. It must be one of
  452. * the <code>int</code> constants in the class
  453. * <code>TCKind</code>.
  454. * @return a new <code>TCKind</code> instance whose <code>value</code>
  455. * field matches the given <code>int</code>
  456. */
  457. protected TCKind(int _value){
  458. this._value = _value;
  459. }
  460. private int _value;
  461. }