Fri, 24 Sep 2010 22:42:14 -0700
6891766: Vulnerabilities in use of reflection in CORBA
Reviewed-by: hawtin
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 */
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 */
33 package org.omg.CORBA;
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 */
49 public class DefinitionKind implements org.omg.CORBA.portable.IDLEntity {
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,
57 /**
58 * The constant that indicates that the type of an Interface Repository object
59 * may be any type.
60 */
61 _dk_all = 1,
63 /**
64 * The constant that indicates that an Interface Repository object is an
65 * attribute.
66 */
67 _dk_Attribute = 2,
69 /**
70 * The constant that indicates that an Interface Repository object is a
71 * constant.
72 */
73 _dk_Constant = 3,
75 /**
76 * The constant that indicates that an Interface Repository object is an
77 * exception.
78 */
80 _dk_Exception = 4,
82 /**
83 * The constant that indicates that an Interface Repository object is an
84 * interface.
85 */
87 _dk_Interface = 5,
89 /**
90 * The constant that indicates that an Interface Repository object is a
91 * module.
92 */
94 _dk_Module = 6,
96 /**
97 * The constant that indicates that an Interface Repository object is an
98 * operation.
99 */
101 _dk_Operation = 7,
103 /**
104 * The constant that indicates that an Interface Repository object is a
105 * Typedef.
106 */
108 _dk_Typedef = 8,
110 /**
111 * The constant that indicates that an Interface Repository object is an
112 * Alias.
113 */
115 _dk_Alias = 9,
117 /**
118 * The constant that indicates that an Interface Repository object is a
119 * Struct.
120 */
122 _dk_Struct = 10,
124 /**
125 * The constant that indicates that an Interface Repository object is a
126 * Union.
127 */
129 _dk_Union = 11,
131 /**
132 * The constant that indicates that an Interface Repository object is an
133 * Enum.
134 */
136 _dk_Enum = 12,
138 /**
139 * The constant that indicates that an Interface Repository object is a
140 * Primitive.
141 */
143 _dk_Primitive = 13,
145 /**
146 * The constant that indicates that an Interface Repository object is a
147 * String.
148 */
150 _dk_String = 14,
152 /**
153 * The constant that indicates that an Interface Repository object is a
154 * Sequence.
155 */
157 _dk_Sequence = 15,
159 /**
160 * The constant that indicates that an Interface Repository object is an
161 * Array.
162 */
164 _dk_Array = 16,
166 /**
167 * The constant that indicates that an Interface Repository object is a
168 * Repository.
169 */
171 _dk_Repository = 17,
173 /**
174 * The constant that indicates that an Interface Repository object is a
175 * Wstring.
176 */
178 _dk_Wstring = 18,
180 /**
181 * The constant that indicates that an Interface Repository object is of type
182 * Fixed.
183 */
185 _dk_Fixed = 19,
187 /**
188 * The constant that indicates that an Interface Repository object is a
189 * Value.
190 */
192 _dk_Value = 20,
194 /**
195 * The constant that indicates that an Interface Repository object is a
196 * ValueBox.
197 */
199 _dk_ValueBox = 21,
201 /**
202 * The constant that indicates that an Interface Repository object is a
203 * ValueMember.
204 */
206 _dk_ValueMember = 22,
208 /**
209 * The constant that indicates that an Interface Repository object is of type
210 * Native.
211 */
213 _dk_Native = 23,
215 /**
216 * The constant that indicates that an Interface Repository object
217 * is representing an abstract interface.
218 */
219 _dk_AbstractInterface = 24;
221 /**
222 * The static instance of <code>DefinitionKind</code> indicating that an
223 * Interface Repository object has no definition kind.
224 */
226 public static final DefinitionKind dk_none = new DefinitionKind(_dk_none);
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 */
236 public static final DefinitionKind dk_all = new DefinitionKind(_dk_all);
238 /**
239 * The static instance of <code>DefinitionKind</code> indicating that an
240 * Interface Repository object is an Attribute.
241 */
243 public static final DefinitionKind dk_Attribute = new DefinitionKind(_dk_Attribute);
245 /**
246 * The static instance of <code>DefinitionKind</code> indicating that an
247 * Interface Repository object is a constant.
248 */
250 public static final DefinitionKind dk_Constant = new DefinitionKind(_dk_Constant);
253 /**
254 * The static instance of <code>DefinitionKind</code> indicating that an
255 * Interface Repository object is an Exception.
256 */
258 public static final DefinitionKind dk_Exception = new DefinitionKind(_dk_Exception);
260 /**
261 * The static instance of <code>DefinitionKind</code> indicating that an
262 * Interface Repository object is an Interface.
263 */
265 public static final DefinitionKind dk_Interface = new DefinitionKind(_dk_Interface);
267 /**
268 * The static instance of <code>DefinitionKind</code> indicating that an
269 * Interface Repository object is a Module.
270 */
272 public static final DefinitionKind dk_Module = new DefinitionKind(_dk_Module);
274 /**
275 * The static instance of <code>DefinitionKind</code> indicating that an
276 * Interface Repository object is an Operation.
277 */
279 public static final DefinitionKind dk_Operation = new DefinitionKind(_dk_Operation);
281 /**
282 * The static instance of <code>DefinitionKind</code> indicating that an
283 * Interface Repository object is a Typedef.
284 */
286 public static final DefinitionKind dk_Typedef = new DefinitionKind(_dk_Typedef);
288 /**
289 * The static instance of <code>DefinitionKind</code> indicating that an
290 * Interface Repository object is an Alias.
291 */
293 public static final DefinitionKind dk_Alias = new DefinitionKind(_dk_Alias);
295 /**
296 * The static instance of <code>DefinitionKind</code> indicating that an
297 * Interface Repository object is a Struct.
298 */
300 public static final DefinitionKind dk_Struct = new DefinitionKind(_dk_Struct);
302 /**
303 * The static instance of <code>DefinitionKind</code> indicating that an
304 * Interface Repository object is a Union.
305 */
307 public static final DefinitionKind dk_Union = new DefinitionKind(_dk_Union);
309 /**
310 * The static instance of <code>DefinitionKind</code> indicating that an
311 * Interface Repository object is an Enum.
312 */
314 public static final DefinitionKind dk_Enum = new DefinitionKind(_dk_Enum);
316 /**
317 * The static instance of <code>DefinitionKind</code> indicating that an
318 * Interface Repository object is a Primitive.
319 */
321 public static final DefinitionKind dk_Primitive = new DefinitionKind(_dk_Primitive);
323 /**
324 * The static instance of <code>DefinitionKind</code> indicating that an
325 * Interface Repository object is a String.
326 */
328 public static final DefinitionKind dk_String = new DefinitionKind(_dk_String);
330 /**
331 * The static instance of <code>DefinitionKind</code> indicating that an
332 * Interface Repository object is a Sequence.
333 */
335 public static final DefinitionKind dk_Sequence = new DefinitionKind(_dk_Sequence);
337 /**
338 * The static instance of <code>DefinitionKind</code> indicating that an
339 * Interface Repository object is an Array.
340 */
342 public static final DefinitionKind dk_Array = new DefinitionKind(_dk_Array);
345 /**
346 * The static instance of <code>DefinitionKind</code> indicating that an
347 * Interface Repository object is a Repository.
348 */
350 public static final DefinitionKind dk_Repository = new DefinitionKind(_dk_Repository);
353 /**
354 * The static instance of <code>DefinitionKind</code> indicating that an
355 * Interface Repository object is a Wstring.
356 */
358 public static final DefinitionKind dk_Wstring = new DefinitionKind(_dk_Wstring);
360 /**
361 * The static instance of <code>DefinitionKind</code> indicating that an
362 * Interface Repository object is a Fixed value.
363 */
365 public static final DefinitionKind dk_Fixed = new DefinitionKind(_dk_Fixed);
367 /**
368 * The static instance of <code>DefinitionKind</code> indicating that an
369 * Interface Repository object is a Value.
370 */
372 public static final DefinitionKind dk_Value = new DefinitionKind(_dk_Value);
374 /**
375 * The static instance of <code>DefinitionKind</code> indicating that an
376 * Interface Repository object is a ValueBox.
377 */
379 public static final DefinitionKind dk_ValueBox = new DefinitionKind(_dk_ValueBox);
381 /**
382 * The static instance of <code>DefinitionKind</code> indicating that an
383 * Interface Repository object is a ValueMember.
384 */
386 public static final DefinitionKind dk_ValueMember = new DefinitionKind(_dk_ValueMember);
389 /**
390 * The static instance of <code>DefinitionKind</code> indicating that an
391 * Interface Repository object is a Native value.
392 */
394 public static final DefinitionKind dk_Native = new DefinitionKind(_dk_Native);
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);
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 */
411 public int value() {
412 return _value;
413 }
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 */
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 }
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 */
491 protected DefinitionKind(int _value){
492 this._value = _value;
493 }
495 /**
496 * The field that holds a value for a <code>DefinitionKind</code> object.
497 * @serial
498 */
500 private int _value;
501 }