FileDocCategorySizeDatePackage
Any.javaAPI DocJava SE 5 API28766Fri Aug 26 14:58:26 BST 2005org.omg.CORBA

Any

public abstract class Any extends Object implements 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 Any object is used as a component of a NamedValue object, which provides information about arguments or return values in requests, and which is used to define name/value pairs in Context objects.

An Any object consists of two parts:

  1. a data value
  2. a TypeCode object describing the type of the data value contained in the Any object. For example, a TypeCode 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 TypeCode object is itself a TypeCode object.)

A large part of the Any class consists of pairs of methods for inserting values into and extracting values from an Any object.

For a given primitive type X, these methods are:

void insert_X(X x)
This method allows the insertion of an instance x of primitive type X into the value field of the Any object. Note that the method insert_X also resets the Any object's type field if necessary.
X extract_X()
This method allows the extraction of an instance of type X from the Any object.

This method throws the exception BAD_OPERATION under two conditions:

  1. the type of the element contained in the Any object is not X
  2. the method extract_X is called before the value field of the Any object has been set

There are distinct method pairs for each primitive IDL data type (insert_long and extract_long, insert_string and extract_string, and so on).

The class Any also has methods for getting and setting the type code, for testing two Any objects for equality, and for reading an Any object from a stream or writing it to a stream.

version
1.12, 09/09/97
since
JDK1.2

Fields Summary
Constructors Summary
Methods Summary
public abstract org.omg.CORBA.portable.InputStreamcreate_input_stream()
Creates an input stream from which this Any object's value can be unmarshalled.

return
the newly-created InputStream

public abstract org.omg.CORBA.portable.OutputStreamcreate_output_stream()
Creates an output stream into which this Any object's value can be marshalled.

return
the newly-created OutputStream

public abstract booleanequal(org.omg.CORBA.Any a)
Checks for equality between this Any object and the given Any object. Two Any objects are equal if both their values and type codes are equal.

param
a the Any object to test for equality
return
true if the Any objects are equal; false otherwise
see
CORBA package comments for unimplemented features

public abstract org.omg.CORBA.Objectextract_Object()
Extracts the org.omg.CORBA.Object in this Any object's value field.

return
the org.omg.CORBA.Object stored in this Any object
exception
BAD_OPERATION if this Any object contains something other than an org.omg.CORBA.Object or the value field has not yet been set

public Principalextract_Principal()
Extracts the Principal object in this Any object's value field. Note that the class Principal has been deprecated.

return
the Principal object stored in this Any object
exception
BAD_OPERATION if this Any object contains something other than a Principal object or the value field has not yet been set
see
CORBA package comments for unimplemented features
deprecated
Deprecated by CORBA 2.2.

	throw new org.omg.CORBA.NO_IMPLEMENT() ;
    
public org.omg.CORBA.portable.Streamableextract_Streamable()
Extracts a Streamable from this Any object's value field. This method allows the extraction of non-primitive IDL types.

return
the Streamable stored in the Any object.
throws
BAD_INV_ORDER if the caller has invoked operations in the wrong order
see
CORBA package comments for unimplemented features

	throw new org.omg.CORBA.NO_IMPLEMENT() ;
    
public abstract TypeCodeextract_TypeCode()
Extracts the TypeCode object in this Any object's value field.

return
the TypeCode object stored in this Any object
exception
BAD_OPERATION if this Any object contains something other than a TypeCode object or the value field has not yet been set

public abstract java.io.Serializableextract_Value()
Extracts the java.io.Serializable object in this Any object's value field.

return
the java.io.Serializable object stored in this Any object
exception
BAD_OPERATION if this Any object contains something other than a java.io.Serializable object or the value field has not yet been set

public abstract org.omg.CORBA.Anyextract_any()
Extracts the Any object in this Any object's value field.

return
the Any object stored in this Any object
exception
BAD_OPERATION if this Any object contains something other than an Any object or the value field has not yet been set

public abstract booleanextract_boolean()
Extracts the boolean in this Any object's value field.

return
the boolean stored in this Any object
exception
BAD_OPERATION if this Any object contains something other than a boolean or the value field has not yet been set

public abstract charextract_char()
Extracts the char in this Any object's value field.

return
the char stored in this Any object
exception
BAD_OPERATION if this Any object contains something other than a char or the value field has not yet been set

public abstract doubleextract_double()
Extracts the double in this Any object's value field.

return
the double stored in this Any object
exception
BAD_OPERATION if this Any object contains something other than a double or the value field has not yet been set

public java.math.BigDecimalextract_fixed()
Extracts the java.math.BigDecimal object in this Any object's value field.

return
the java.math.BigDecimal object stored in this Any object
exception
BAD_OPERATION if this Any object contains something other than a java.math.BigDecimal object or the value field has not yet been set
see
CORBA package comments for unimplemented features

        throw new org.omg.CORBA.NO_IMPLEMENT();
    
public abstract floatextract_float()
Extracts the float in this Any object's value field.

return
the float stored in this Any object
exception
BAD_OPERATION if this Any object contains something other than a float or the value field has not yet been set

public abstract intextract_long()
Extracts the int in this Any object's value field.

return
the int stored in this Any object
exception
BAD_OPERATION if this Any object contains something other than an int or the value field has not yet been set

public abstract longextract_longlong()
Extracts the long in this Any object's value field.

return
the long stored in this Any object
exception
BAD_OPERATION if this Any object contains something other than a long or the value field has not yet been set

public abstract byteextract_octet()
Extracts the byte in this Any object's value field.

return
the byte stored in this Any object
exception
BAD_OPERATION if this Any object contains something other than a byte or the value field has not yet been set

public abstract shortextract_short()
Extracts the short in this Any object's value field.

return
the short stored in this Any object
exception
BAD_OPERATION if this Any object contains something other than a short or the value field has not yet been set

public abstract java.lang.Stringextract_string()
Extracts the String object in this Any object's value field.

return
the String object stored in this Any object
exception
BAD_OPERATION if this Any object contains something other than a String object or the value field has not yet been set

public abstract intextract_ulong()
Extracts the int in this Any object's value field.

return
the int stored in this Any object
exception
BAD_OPERATION if this Any object contains something other than an int or the value field has not yet been set

public abstract longextract_ulonglong()
Extracts the long in this Any object's value field.

return
the long stored in this Any object
exception
BAD_OPERATION if this Any object contains something other than a long or the value field has not yet been set

public abstract shortextract_ushort()
Extracts the short in this Any object's value field.

return
the short stored in this Any object
exception
BAD_OPERATION if this Any object contains something other than a short or the value field has not yet been set

public abstract charextract_wchar()
Extracts the char in this Any object's value field.

return
the char stored in this Any object
exception
BAD_OPERATION if this Any object contains something other than a char or the value field has not yet been set

public abstract java.lang.Stringextract_wstring()
Extracts the String object in this Any object's value field.

return
the String object stored in this Any object
exception
BAD_OPERATION if this Any object contains something other than a String object or the value field has not yet been set

public abstract voidinsert_Object(org.omg.CORBA.Object o)
Inserts the given org.omg.CORBA.Object object into this Any object's value field.

param
o the org.omg.CORBA.Object object to insert into this Any object

public abstract voidinsert_Object(org.omg.CORBA.Object o, TypeCode t)
Inserts the given org.omg.CORBA.Object object into this Any object's value field.

param
o the org.omg.CORBA.Object instance to insert into this Any object
param
t the TypeCode object that is to be inserted into this Any object and that describes the Object being inserted
exception
BAD_OPERATION if this method is invalid for this Any object

public voidinsert_Principal(Principal p)
Inserts the given Principal object into this Any object's value field. Note that the class Principal has been deprecated.

param
p the Principal object to insert into this Any object
see
CORBA package comments for unimplemented features
deprecated
Deprecated by CORBA 2.2.

	throw new org.omg.CORBA.NO_IMPLEMENT() ;
    
public voidinsert_Streamable(org.omg.CORBA.portable.Streamable s)
Inserts the given Streamable object into this Any object's value field. This method allows the insertion of non-primitive IDL types.

param
s the Streamable object to insert into this Any object; may be a non-primitive IDL type
see
CORBA package comments for unimplemented features

	throw new org.omg.CORBA.NO_IMPLEMENT() ;
    
public abstract voidinsert_TypeCode(TypeCode t)
Inserts the given TypeCode object into this Any object's value field.

param
t the TypeCode object to insert into this Any object

public abstract voidinsert_Value(java.io.Serializable v)
Inserts the given java.io.Serializable object into this Any object's value field.

param
v the java.io.Serializable object to insert into this Any object

public abstract voidinsert_Value(java.io.Serializable v, TypeCode t)
Inserts the given java.io.Serializable object into this Any object's value field.

param
v the java.io.Serializable object to insert into this Any object
param
t the TypeCode object that is to be inserted into this Any object's type field and that describes the java.io.Serializable object being inserted
throws
MARSHAL if the ORB has a problem marshalling or unmarshalling parameters

public abstract voidinsert_any(org.omg.CORBA.Any a)
Inserts the given Any object into this Any object's value field.

param
a the Any object to insert into this Any object

public abstract voidinsert_boolean(boolean b)
Inserts the given boolean into this Any object's value field.

param
b the boolean to insert into this Any object

public abstract voidinsert_char(char c)
Inserts the given char into this Any object's value field.

param
c the char to insert into this Any object
exception
DATA_CONVERSION if there is a data conversion error

public abstract voidinsert_double(double d)
Inserts the given double into this Any object's value field.

param
d the double to insert into this Any object

public voidinsert_fixed(java.math.BigDecimal value)
Throws an org.omg.CORBA.NO_IMPLEMENT exception.

Inserts the given java.math.BigDecimal object into this Any object's value field.

param
value the java.math.BigDecimal object to insert into this Any object
see
CORBA package comments for unimplemented features

	throw new org.omg.CORBA.NO_IMPLEMENT();
    
public voidinsert_fixed(java.math.BigDecimal value, org.omg.CORBA.TypeCode type)
Throws an org.omg.CORBA.NO_IMPLEMENT exception.

Inserts the given java.math.BigDecimal object into this Any object's value field.

param
value the java.math.BigDecimal object to insert into this Any object
param
type the TypeCode object that is to be inserted into this Any object's type field and that describes the java.math.BigDecimal object being inserted
throws
org.omg.CORBA.BAD_INV_ORDER if this method is invoked improperly
see
CORBA package comments for unimplemented features

	throw new org.omg.CORBA.NO_IMPLEMENT();
    
public abstract voidinsert_float(float f)
Inserts the given float into this Any object's value field.

param
f the float to insert into this Any object

public abstract voidinsert_long(int l)
Inserts the given int into this Any object's value field.

param
l the int to insert into this Any object

public abstract voidinsert_longlong(long l)
Inserts the given long into this Any object's value field.

param
l the long to insert into this Any object

public abstract voidinsert_octet(byte b)
Inserts the given byte into this Any object's value field.

param
b the byte to insert into this Any object

public abstract voidinsert_short(short s)
Inserts the given short into this Any object's value field.

param
s the short to insert into this Any object

public abstract voidinsert_string(java.lang.String s)
Inserts the given String object into this Any object's value field.

param
s the String object to insert into this Any object
exception
DATA_CONVERSION if there is a data conversion error
exception
MARSHAL if the ORB has a problem marshalling or unmarshalling parameters

public abstract voidinsert_ulong(int l)
Inserts the given int into this Any object's value field.

param
l the int to insert into this Any object

public abstract voidinsert_ulonglong(long l)
Inserts the given long into this Any object's value field.

param
l the long to insert into this Any object

public abstract voidinsert_ushort(short s)
Inserts the given short into this Any object's value field.

param
s the short to insert into this Any object

public abstract voidinsert_wchar(char c)
Inserts the given char into this Any object's value field.

param
c the char to insert into this Any object

public abstract voidinsert_wstring(java.lang.String s)
Inserts the given String object into this Any object's value field.

param
s the String object to insert into this Any object
exception
MARSHAL if the ORB has a problem marshalling or unmarshalling parameters

public abstract voidread_value(org.omg.CORBA.portable.InputStream is, TypeCode t)
Reads off (unmarshals) the value of an Any object from the given input stream using the given typecode.

param
is the org.omg.CORBA.portable.InputStream object from which to read the value contained in this Any object
param
t a TypeCode object containing type information about the value to be read
exception
MARSHAL when the given TypeCode object is not consistent with the value that was contained in the input stream

public abstract TypeCodetype()
Returns type information for the element contained in this Any object.

return
the TypeCode object containing type information about the value contained in this Any object

public abstract voidtype(TypeCode t)
Sets this Any object's type field to the given TypeCode object and clears its value.

Note that using this method to set the type code wipes out the value if there is one. The method is provided primarily so that the type may be set properly for IDL out parameters. Generally, setting the type is done by the insert_X methods, which will set the type to X if it is not already set to X.

param
t the TypeCode object giving information for the value in this Any object

public abstract voidwrite_value(org.omg.CORBA.portable.OutputStream os)
Writes out the value of this Any object to the given output stream. If both typecode and value need to be written, use create_output_stream() to create an OutputStream, then use write_any on the OutputStream.

If this method is called on an Any object that has not had a value inserted into its value field, it will throw the exception java.lang.NullPointerException.

param
os the org.omg.CORBA.portable.OutputStream object into which to marshal the value of this Any object