1 /*
2 * Copyright (c) 1997, 2004, 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
35 * described in IDL or for any IDL primitive type.
36 * An <code>Any</code> object is used as a component of a
37 * <code>NamedValue</code> object, which provides information about
38 * arguments or return values in requests, and which is used to define
39 * name/value pairs in <code>Context</code> objects.
40 <p>
41 *
42 * An <code>Any</code> object consists of two parts:
43 * <OL>
44 * <LI>a data value
45 * <LI>a <code>TypeCode</code> object describing the type of the data
46 * value contained in the <code>Any</code> object. For example,
47 * a <code>TypeCode</code> object for an array contains
48 * a field for the length of the array and a field for
49 * the type of elements in the array. (Note that in this case, the
50 * second field of the <code>TypeCode</code> object is itself a
51 * <code>TypeCode</code> object.)
52 * </OL>
53 *
54 * <P>
55 * <a name="anyOps"</a>
56 * A large part of the <code>Any</code> class consists of pairs of methods
57 * for inserting values into and extracting values from an
58 * <code>Any</code> object.
59 * <P>
60 * For a given primitive type X, these methods are:
61 * <dl>
62 * <dt><code><bold> void insert_X(X x)</bold></code>
63 * <dd> This method allows the insertion of
64 * an instance <code>x</code> of primitive type <code>X</code>
65 * into the <code>value</code> field of the <code>Any</code> object.
66 * Note that the method
67 * <code>insert_X</code> also resets the <code>Any</code> object's
68 * <code>type</code> field if necessary.
69 * <dt> <code><bold>X extract_X()</bold></code>
70 * <dd> This method allows the extraction of an instance of
71 * type <code>X</code> from the <code>Any</code> object.
72 * <BR>
73 * <P>
74 * This method throws the exception <code>BAD_OPERATION</code> under two conditions:
75 * <OL>
76 * <LI> the type of the element contained in the <code>Any</code> object is not
77 * <code>X</code>
78 * <LI> the method <code>extract_X</code> is called before
79 * the <code>value</code> field of the <code>Any</code> object
80 * has been set
81 * </OL>
82 * </dl>
83 * <P>
84 * There are distinct method pairs for each
85 * primitive IDL data type (<code>insert_long</code> and <code>extract_long</code>,
86 * <code>insert_string</code> and <code>extract_string</code>, and so on).<BR>
87 * <P>
88 * The class <code>Any</code> also has methods for
89 * getting and setting the type code,
|
1 /*
2 * Copyright (c) 1997, 2015, 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
35 * described in IDL or for any IDL primitive type.
36 * An <code>Any</code> object is used as a component of a
37 * <code>NamedValue</code> object, which provides information about
38 * arguments or return values in requests, and which is used to define
39 * name/value pairs in <code>Context</code> objects.
40 <p>
41 *
42 * An <code>Any</code> object consists of two parts:
43 * <OL>
44 * <LI>a data value
45 * <LI>a <code>TypeCode</code> object describing the type of the data
46 * value contained in the <code>Any</code> object. For example,
47 * a <code>TypeCode</code> object for an array contains
48 * a field for the length of the array and a field for
49 * the type of elements in the array. (Note that in this case, the
50 * second field of the <code>TypeCode</code> object is itself a
51 * <code>TypeCode</code> object.)
52 * </OL>
53 *
54 * <P>
55 * <a name="anyOps"></a>
56 * A large part of the <code>Any</code> class consists of pairs of methods
57 * for inserting values into and extracting values from an
58 * <code>Any</code> object.
59 * <P>
60 * For a given primitive type X, these methods are:
61 * <dl>
62 * <dt><code><b>void insert_X(X x)</b></code>
63 * <dd> This method allows the insertion of
64 * an instance <code>x</code> of primitive type <code>X</code>
65 * into the <code>value</code> field of the <code>Any</code> object.
66 * Note that the method
67 * <code>insert_X</code> also resets the <code>Any</code> object's
68 * <code>type</code> field if necessary.
69 * <dt> <code><b>X extract_X()</b></code>
70 * <dd> This method allows the extraction of an instance of
71 * type <code>X</code> from the <code>Any</code> object.
72 * <BR>
73 * <P>
74 * This method throws the exception <code>BAD_OPERATION</code> under two conditions:
75 * <OL>
76 * <LI> the type of the element contained in the <code>Any</code> object is not
77 * <code>X</code>
78 * <LI> the method <code>extract_X</code> is called before
79 * the <code>value</code> field of the <code>Any</code> object
80 * has been set
81 * </OL>
82 * </dl>
83 * <P>
84 * There are distinct method pairs for each
85 * primitive IDL data type (<code>insert_long</code> and <code>extract_long</code>,
86 * <code>insert_string</code> and <code>extract_string</code>, and so on).<BR>
87 * <P>
88 * The class <code>Any</code> also has methods for
89 * getting and setting the type code,
|