/*
* @(#)Any.java 1.47 05/11/17
*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package org.omg.CORBA;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.Streamable;
import org.omg.CORBA.portable.IDLEntity;
/**
* Serves as a container for any data that can be
* described in IDL or for any IDL primitive type.
* An <code>Any</code> object is used as a component of a
* <code>NamedValue</code> object, which provides information about
* arguments or return values in requests, and which is used to define
* name/value pairs in <code>Context</code> objects.
<p>
*
* An <code>Any</code> object consists of two parts:
* <OL>
* <LI>a data value
* <LI>a <code>TypeCode</code> object describing the type of the data
* value contained in the <code>Any</code> object. For example,
* a <code>TypeCode</code> object for an array contains
* a field for the length of the array and a field for
* the type of elements in the array. (Note that in this case, the
* second field of the <code>TypeCode</code> object is itself a
* <code>TypeCode</code> object.)
* </OL>
*
* <P>
* <a name="anyOps"</a>
* A large part of the <code>Any</code> class consists of pairs of methods
* for inserting values into and extracting values from an
* <code>Any</code> object.
* <P>
* For a given primitive type X, these methods are:
* <dl>
* <dt><code><bold> void insert_X(X x)</bold></code>
* <dd> This method allows the insertion of
* an instance <code>x</code> of primitive type <code>X</code>
* into the <code>value</code> field of the <code>Any</code> object.
* Note that the method
* <code>insert_X</code> also resets the <code>Any</code> object's
* <code>type</code> field if necessary.
* <dt> <code><bold>X extract_X()</bold></code>
* <dd> This method allows the extraction of an instance of
* type <code>X</code> from the <code>Any</code> object.
* <BR>
* <P>
* This method throws the exception <code>BAD_OPERATION</code> under two conditions:
* <OL>
* <LI> the type of the element contained in the <code>Any</code> object is not
* <code>X</code>
* <LI> the method <code>extract_X</code> is called before
* the <code>value</code> field of the <code>Any</code> object
* has been set
* </OL>
* </dl>
* <P>
* There are distinct method pairs for each
* primitive IDL data type (<code>insert_long</code> and <code>extract_long</code>,
* <code>insert_string</code> and <code>extract_string</code>, and so on).<BR>
* <P>
* The class <code>Any</code> also has methods for
* getting and setting the type code,
* for testing two <code>Any</code> objects for equality,
* and for reading an <code>Any</code> object from a stream or
* writing it to a stream.
* <BR>
* @version 1.12, 09/09/97
* @since JDK1.2
*/
abstract public class Any implements IDLEntity {
/**
* Checks for equality between this <code>Any</code> object and the
* given <code>Any</code> object. Two <code>Any</code> objects are
* equal if both their values and type codes are equal.
*
* @param a the <code>Any</code> object to test for equality
* @return <code>true</code> if the <code>Any</code> objects are equal;
* <code>false</code> otherwise
* @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
* comments for unimplemented features</a>
*/
abstract public boolean equal(Any a);
/**
* Returns type information for the element contained in this
* <code>Any</code> object.
*
* @return the <code>TypeCode</code> object containing type information
* about the value contained in this <code>Any</code> object
*/
=1= |