- java.lang.Object
- 
- org.omg.CORBA.Any
 
- 
- All Implemented Interfaces:
- Serializable,- IDLEntity
 
 
 public abstract class Any extends Object implements IDLEntity Serves as a container for any data that can be described in IDL or for any IDL primitive type. AnAnyobject is used as a component of aNamedValueobject, which provides information about arguments or return values in requests, and which is used to define name/value pairs inContextobjects.An Anyobject consists of two parts:- a data value
- a TypeCodeobject describing the type of the data value contained in theAnyobject. For example, aTypeCodeobject 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 theTypeCodeobject is itself aTypeCodeobject.)
 A large part of the Anyclass consists of pairs of methods for inserting values into and extracting values from anAnyobject.For a given primitive type X, these methods are: - void insert_X(X x)
-  This method allows the insertion of
        an instance xof primitive typeXinto thevaluefield of theAnyobject. Note that the methodinsert_Xalso resets theAnyobject'stypefield if necessary.
-  X extract_X()
-  This method allows the extraction of an instance of
        type Xfrom theAnyobject.
 This method throws the exception BAD_OPERATIONunder two conditions:-  the type of the element contained in the Anyobject is notX
-  the method extract_Xis called before thevaluefield of theAnyobject has been set
 
-  the type of the element contained in the 
 There are distinct method pairs for each primitive IDL data type ( insert_longandextract_long,insert_stringandextract_string, and so on).
 The class Anyalso has methods for getting and setting the type code, for testing twoAnyobjects for equality, and for reading anAnyobject from a stream or writing it to a stream.- Since:
- JDK1.2
 
- 
- 
Constructor SummaryConstructors Constructor Description Any()
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract InputStreamcreate_input_stream()Creates an input stream from which thisAnyobject's value can be unmarshalled.abstract OutputStreamcreate_output_stream()Creates an output stream into which thisAnyobject's value can be marshalled.abstract booleanequal(Any a)Checks for equality between thisAnyobject and the givenAnyobject.abstract Anyextract_any()Extracts theAnyobject in thisAnyobject'svaluefield.abstract booleanextract_boolean()Extracts thebooleanin thisAnyobject'svaluefield.abstract charextract_char()Extracts thecharin thisAnyobject'svaluefield.abstract doubleextract_double()Extracts thedoublein thisAnyobject'svaluefield.BigDecimalextract_fixed()Extracts thejava.math.BigDecimalobject in thisAnyobject'svaluefield.abstract floatextract_float()Extracts thefloatin thisAnyobject'svaluefield.abstract intextract_long()Extracts theintin thisAnyobject'svaluefield.abstract longextract_longlong()Extracts thelongin thisAnyobject'svaluefield.abstract Objectextract_Object()Extracts theorg.omg.CORBA.Objectin thisAnyobject'svaluefield.abstract byteextract_octet()Extracts thebytein thisAnyobject'svaluefield.Principalextract_Principal()Deprecated.Deprecated by CORBA 2.2.abstract shortextract_short()Extracts theshortin thisAnyobject'svaluefield.Streamableextract_Streamable()Extracts aStreamablefrom thisAnyobject'svaluefield.abstract Stringextract_string()Extracts theStringobject in thisAnyobject'svaluefield.abstract TypeCodeextract_TypeCode()Extracts theTypeCodeobject in thisAnyobject'svaluefield.abstract intextract_ulong()Extracts theintin thisAnyobject'svaluefield.abstract longextract_ulonglong()Extracts thelongin thisAnyobject'svaluefield.abstract shortextract_ushort()Extracts theshortin thisAnyobject'svaluefield.abstract Serializableextract_Value()Extracts thejava.io.Serializableobject in thisAnyobject'svaluefield.abstract charextract_wchar()Extracts thecharin thisAnyobject'svaluefield.abstract Stringextract_wstring()Extracts theStringobject in thisAnyobject'svaluefield.abstract voidinsert_any(Any a)Inserts the givenAnyobject into thisAnyobject'svaluefield.abstract voidinsert_boolean(boolean b)Inserts the givenbooleaninto thisAnyobject'svaluefield.abstract voidinsert_char(char c)Inserts the givencharinto thisAnyobject'svaluefield.abstract voidinsert_double(double d)Inserts the givendoubleinto thisAnyobject'svaluefield.voidinsert_fixed(BigDecimal value)Throws anorg.omg.CORBA.NO_IMPLEMENTexception.voidinsert_fixed(BigDecimal value, TypeCode type)Throws anorg.omg.CORBA.NO_IMPLEMENTexception.abstract voidinsert_float(float f)Inserts the givenfloatinto thisAnyobject'svaluefield.abstract voidinsert_long(int l)Inserts the givenintinto thisAnyobject'svaluefield.abstract voidinsert_longlong(long l)Inserts the givenlonginto thisAnyobject'svaluefield.abstract voidinsert_Object(Object o)Inserts the givenorg.omg.CORBA.Objectobject into thisAnyobject'svaluefield.abstract voidinsert_Object(Object o, TypeCode t)Inserts the givenorg.omg.CORBA.Objectobject into thisAnyobject'svaluefield.abstract voidinsert_octet(byte b)Inserts the givenbyteinto thisAnyobject'svaluefield.voidinsert_Principal(Principal p)Deprecated.Deprecated by CORBA 2.2.abstract voidinsert_short(short s)Inserts the givenshortinto thisAnyobject'svaluefield.voidinsert_Streamable(Streamable s)Inserts the givenStreamableobject into thisAnyobject'svaluefield.abstract voidinsert_string(String s)Inserts the givenStringobject into thisAnyobject'svaluefield.abstract voidinsert_TypeCode(TypeCode t)Inserts the givenTypeCodeobject into thisAnyobject'svaluefield.abstract voidinsert_ulong(int l)Inserts the givenintinto thisAnyobject'svaluefield.abstract voidinsert_ulonglong(long l)Inserts the givenlonginto thisAnyobject'svaluefield.abstract voidinsert_ushort(short s)Inserts the givenshortinto thisAnyobject'svaluefield.abstract voidinsert_Value(Serializable v)Inserts the givenjava.io.Serializableobject into thisAnyobject'svaluefield.abstract voidinsert_Value(Serializable v, TypeCode t)Inserts the givenjava.io.Serializableobject into thisAnyobject'svaluefield.abstract voidinsert_wchar(char c)Inserts the givencharinto thisAnyobject'svaluefield.abstract voidinsert_wstring(String s)Inserts the givenStringobject into thisAnyobject'svaluefield.abstract voidread_value(InputStream is, TypeCode t)Reads off (unmarshals) the value of anAnyobject from the given input stream using the given typecode.abstract TypeCodetype()Returns type information for the element contained in thisAnyobject.abstract voidtype(TypeCode t)Sets thisAnyobject'stypefield to the givenTypeCodeobject and clears its value.abstract voidwrite_value(OutputStream os)Writes out the value of thisAnyobject to the given output stream.
 
- 
- 
- 
Method Detail- 
equalpublic abstract boolean equal(Any a) Checks for equality between thisAnyobject and the givenAnyobject. TwoAnyobjects are equal if both their values and type codes are equal.- Parameters:
- a- the- Anyobject to test for equality
- Returns:
- trueif the- Anyobjects are equal;- falseotherwise
- See Also:
- CORBApackage comments for unimplemented features
 
 - 
typepublic abstract TypeCode type() Returns type information for the element contained in thisAnyobject.- Returns:
- the TypeCodeobject containing type information about the value contained in thisAnyobject
 
 - 
typepublic abstract void type(TypeCode t) Sets thisAnyobject'stypefield to the givenTypeCodeobject 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 outparameters. Generally, setting the type is done by theinsert_Xmethods, which will set the type to X if it is not already set to X.- Parameters:
- t- the- TypeCodeobject giving information for the value in this- Anyobject
 
 - 
read_valuepublic abstract void read_value(InputStream is, TypeCode t) throws MARSHAL Reads off (unmarshals) the value of anAnyobject from the given input stream using the given typecode.- Parameters:
- is- the- org.omg.CORBA.portable.InputStreamobject from which to read the value contained in this- Anyobject
- t- a- TypeCodeobject containing type information about the value to be read
- Throws:
- MARSHAL- when the given- TypeCodeobject is not consistent with the value that was contained in the input stream
 
 - 
write_valuepublic abstract void write_value(OutputStream os) Writes out the value of thisAnyobject to the given output stream. If bothtypecodeandvalueneed to be written, usecreate_output_stream()to create anOutputStream, then usewrite_anyon theOutputStream.If this method is called on an Anyobject that has not had a value inserted into itsvaluefield, it will throw the exceptionjava.lang.NullPointerException.- Parameters:
- os- the- org.omg.CORBA.portable.OutputStreamobject into which to marshal the value of this- Anyobject
 
 - 
create_output_streampublic abstract OutputStream create_output_stream() Creates an output stream into which thisAnyobject's value can be marshalled.- Returns:
- the newly-created OutputStream
 
 - 
create_input_streampublic abstract InputStream create_input_stream() Creates an input stream from which thisAnyobject's value can be unmarshalled.- Returns:
- the newly-created InputStream
 
 - 
extract_shortpublic abstract short extract_short() throws BAD_OPERATIONExtracts theshortin thisAnyobject'svaluefield.- Returns:
- the shortstored in thisAnyobject
- Throws:
- BAD_OPERATION- if this- Anyobject contains something other than a- shortor the- valuefield has not yet been set
 
 - 
insert_shortpublic abstract void insert_short(short s) Inserts the givenshortinto thisAnyobject'svaluefield.- Parameters:
- s- the- shortto insert into this- Anyobject
 
 - 
extract_longpublic abstract int extract_long() throws BAD_OPERATIONExtracts theintin thisAnyobject'svaluefield.- Returns:
- the intstored in thisAnyobject
- Throws:
- BAD_OPERATION- if this- Anyobject contains something other than an- intor the- valuefield has not yet been set
 
 - 
insert_longpublic abstract void insert_long(int l) Inserts the givenintinto thisAnyobject'svaluefield.- Parameters:
- l- the- intto insert into this- Anyobject
 
 - 
extract_longlongpublic abstract long extract_longlong() throws BAD_OPERATIONExtracts thelongin thisAnyobject'svaluefield.- Returns:
- the longstored in thisAnyobject
- Throws:
- BAD_OPERATION- if this- Anyobject contains something other than a- longor the- valuefield has not yet been set
 
 - 
insert_longlongpublic abstract void insert_longlong(long l) Inserts the givenlonginto thisAnyobject'svaluefield.- Parameters:
- l- the- longto insert into this- Anyobject
 
 - 
extract_ushortpublic abstract short extract_ushort() throws BAD_OPERATIONExtracts theshortin thisAnyobject'svaluefield.- Returns:
- the shortstored in thisAnyobject
- Throws:
- BAD_OPERATION- if this- Anyobject contains something other than a- shortor the- valuefield has not yet been set
 
 - 
insert_ushortpublic abstract void insert_ushort(short s) Inserts the givenshortinto thisAnyobject'svaluefield.- Parameters:
- s- the- shortto insert into this- Anyobject
 
 - 
extract_ulongpublic abstract int extract_ulong() throws BAD_OPERATIONExtracts theintin thisAnyobject'svaluefield.- Returns:
- the intstored in thisAnyobject
- Throws:
- BAD_OPERATION- if this- Anyobject contains something other than an- intor the- valuefield has not yet been set
 
 - 
insert_ulongpublic abstract void insert_ulong(int l) Inserts the givenintinto thisAnyobject'svaluefield.- Parameters:
- l- the- intto insert into this- Anyobject
 
 - 
extract_ulonglongpublic abstract long extract_ulonglong() throws BAD_OPERATIONExtracts thelongin thisAnyobject'svaluefield.- Returns:
- the longstored in thisAnyobject
- Throws:
- BAD_OPERATION- if this- Anyobject contains something other than a- longor the- valuefield has not yet been set
 
 - 
insert_ulonglongpublic abstract void insert_ulonglong(long l) Inserts the givenlonginto thisAnyobject'svaluefield.- Parameters:
- l- the- longto insert into this- Anyobject
 
 - 
extract_floatpublic abstract float extract_float() throws BAD_OPERATIONExtracts thefloatin thisAnyobject'svaluefield.- Returns:
- the floatstored in thisAnyobject
- Throws:
- BAD_OPERATION- if this- Anyobject contains something other than a- floator the- valuefield has not yet been set
 
 - 
insert_floatpublic abstract void insert_float(float f) Inserts the givenfloatinto thisAnyobject'svaluefield.- Parameters:
- f- the- floatto insert into this- Anyobject
 
 - 
extract_doublepublic abstract double extract_double() throws BAD_OPERATIONExtracts thedoublein thisAnyobject'svaluefield.- Returns:
- the doublestored in thisAnyobject
- Throws:
- BAD_OPERATION- if this- Anyobject contains something other than a- doubleor the- valuefield has not yet been set
 
 - 
insert_doublepublic abstract void insert_double(double d) Inserts the givendoubleinto thisAnyobject'svaluefield.- Parameters:
- d- the- doubleto insert into this- Anyobject
 
 - 
extract_booleanpublic abstract boolean extract_boolean() throws BAD_OPERATIONExtracts thebooleanin thisAnyobject'svaluefield.- Returns:
- the booleanstored in thisAnyobject
- Throws:
- BAD_OPERATION- if this- Anyobject contains something other than a- booleanor the- valuefield has not yet been set
 
 - 
insert_booleanpublic abstract void insert_boolean(boolean b) Inserts the givenbooleaninto thisAnyobject'svaluefield.- Parameters:
- b- the- booleanto insert into this- Anyobject
 
 - 
extract_charpublic abstract char extract_char() throws BAD_OPERATIONExtracts thecharin thisAnyobject'svaluefield.- Returns:
- the charstored in thisAnyobject
- Throws:
- BAD_OPERATION- if this- Anyobject contains something other than a- charor the- valuefield has not yet been set
 
 - 
insert_charpublic abstract void insert_char(char c) throws DATA_CONVERSIONInserts the givencharinto thisAnyobject'svaluefield.- Parameters:
- c- the- charto insert into this- Anyobject
- Throws:
- DATA_CONVERSION- if there is a data conversion error
 
 - 
extract_wcharpublic abstract char extract_wchar() throws BAD_OPERATIONExtracts thecharin thisAnyobject'svaluefield.- Returns:
- the charstored in thisAnyobject
- Throws:
- BAD_OPERATION- if this- Anyobject contains something other than a- charor the- valuefield has not yet been set
 
 - 
insert_wcharpublic abstract void insert_wchar(char c) Inserts the givencharinto thisAnyobject'svaluefield.- Parameters:
- c- the- charto insert into this- Anyobject
 
 - 
extract_octetpublic abstract byte extract_octet() throws BAD_OPERATIONExtracts thebytein thisAnyobject'svaluefield.- Returns:
- the bytestored in thisAnyobject
- Throws:
- BAD_OPERATION- if this- Anyobject contains something other than a- byteor the- valuefield has not yet been set
 
 - 
insert_octetpublic abstract void insert_octet(byte b) Inserts the givenbyteinto thisAnyobject'svaluefield.- Parameters:
- b- the- byteto insert into this- Anyobject
 
 - 
extract_anypublic abstract Any extract_any() throws BAD_OPERATION Extracts theAnyobject in thisAnyobject'svaluefield.- Returns:
- the Anyobject stored in thisAnyobject
- Throws:
- BAD_OPERATION- if this- Anyobject contains something other than an- Anyobject or the- valuefield has not yet been set
 
 - 
insert_anypublic abstract void insert_any(Any a) Inserts the givenAnyobject into thisAnyobject'svaluefield.- Parameters:
- a- the- Anyobject to insert into this- Anyobject
 
 - 
extract_Objectpublic abstract Object extract_Object() throws BAD_OPERATION Extracts theorg.omg.CORBA.Objectin thisAnyobject'svaluefield.- Returns:
- the org.omg.CORBA.Objectstored in thisAnyobject
- Throws:
- BAD_OPERATION- if this- Anyobject contains something other than an- org.omg.CORBA.Objector the- valuefield has not yet been set
 
 - 
insert_Objectpublic abstract void insert_Object(Object o) Inserts the givenorg.omg.CORBA.Objectobject into thisAnyobject'svaluefield.- Parameters:
- o- the- org.omg.CORBA.Objectobject to insert into this- Anyobject
 
 - 
extract_Valuepublic abstract Serializable extract_Value() throws BAD_OPERATION Extracts thejava.io.Serializableobject in thisAnyobject'svaluefield.- Returns:
- the java.io.Serializableobject stored in thisAnyobject
- Throws:
- BAD_OPERATION- if this- Anyobject contains something other than a- java.io.Serializableobject or the- valuefield has not yet been set
 
 - 
insert_Valuepublic abstract void insert_Value(Serializable v) Inserts the givenjava.io.Serializableobject into thisAnyobject'svaluefield.- Parameters:
- v- the- java.io.Serializableobject to insert into this- Anyobject
 
 - 
insert_Valuepublic abstract void insert_Value(Serializable v, TypeCode t) throws MARSHAL Inserts the givenjava.io.Serializableobject into thisAnyobject'svaluefield.- Parameters:
- v- the- java.io.Serializableobject to insert into this- Anyobject
- t- the- TypeCodeobject that is to be inserted into this- Anyobject's- typefield and that describes the- java.io.Serializableobject being inserted
- Throws:
- MARSHAL- if the ORB has a problem marshalling or unmarshalling parameters
 
 - 
insert_Objectpublic abstract void insert_Object(Object o, TypeCode t) throws BAD_PARAM Inserts the givenorg.omg.CORBA.Objectobject into thisAnyobject'svaluefield.- Parameters:
- o- the- org.omg.CORBA.Objectinstance to insert into this- Anyobject
- t- the- TypeCodeobject that is to be inserted into this- Anyobject and that describes the- Objectbeing inserted
- Throws:
- BAD_OPERATION- if this method is invalid for this- Anyobject
- BAD_PARAM
 
 - 
extract_stringpublic abstract String extract_string() throws BAD_OPERATION Extracts theStringobject in thisAnyobject'svaluefield.- Returns:
- the Stringobject stored in thisAnyobject
- Throws:
- BAD_OPERATION- if this- Anyobject contains something other than a- Stringobject or the- valuefield has not yet been set
 
 - 
insert_stringpublic abstract void insert_string(String s) throws DATA_CONVERSION, MARSHAL Inserts the givenStringobject into thisAnyobject'svaluefield.- Parameters:
- s- the- Stringobject to insert into this- Anyobject
- Throws:
- DATA_CONVERSION- if there is a data conversion error
- MARSHAL- if the ORB has a problem marshalling or unmarshalling parameters
 
 - 
extract_wstringpublic abstract String extract_wstring() throws BAD_OPERATION Extracts theStringobject in thisAnyobject'svaluefield.- Returns:
- the Stringobject stored in thisAnyobject
- Throws:
- BAD_OPERATION- if this- Anyobject contains something other than a- Stringobject or the- valuefield has not yet been set
 
 - 
insert_wstringpublic abstract void insert_wstring(String s) throws MARSHAL Inserts the givenStringobject into thisAnyobject'svaluefield.- Parameters:
- s- the- Stringobject to insert into this- Anyobject
- Throws:
- MARSHAL- if the ORB has a problem marshalling or unmarshalling parameters
 
 - 
extract_TypeCodepublic abstract TypeCode extract_TypeCode() throws BAD_OPERATION Extracts theTypeCodeobject in thisAnyobject'svaluefield.- Returns:
- the TypeCodeobject stored in thisAnyobject
- Throws:
- BAD_OPERATION- if this- Anyobject contains something other than a- TypeCodeobject or the- valuefield has not yet been set
 
 - 
insert_TypeCodepublic abstract void insert_TypeCode(TypeCode t) Inserts the givenTypeCodeobject into thisAnyobject'svaluefield.- Parameters:
- t- the- TypeCodeobject to insert into this- Anyobject
 
 - 
extract_Principal@Deprecated public Principal extract_Principal() throws BAD_OPERATION Deprecated. Deprecated by CORBA 2.2.Extracts thePrincipalobject in thisAnyobject'svaluefield. Note that the classPrincipalhas been deprecated.- Returns:
- the Principalobject stored in thisAnyobject
- Throws:
- BAD_OPERATION- if this- Anyobject contains something other than a- Principalobject or the- valuefield has not yet been set
- See Also:
- CORBApackage comments for unimplemented features
 
 - 
insert_Principal@Deprecated public void insert_Principal(Principal p) Deprecated. Deprecated by CORBA 2.2.Inserts the givenPrincipalobject into thisAnyobject'svaluefield. Note that the classPrincipalhas been deprecated.- Parameters:
- p- the- Principalobject to insert into this- Anyobject
- See Also:
- CORBApackage comments for unimplemented features
 
 - 
extract_Streamablepublic Streamable extract_Streamable() throws BAD_INV_ORDER Extracts aStreamablefrom thisAnyobject'svaluefield. This method allows the extraction of non-primitive IDL types.- Returns:
- the Streamablestored in theAnyobject.
- Throws:
- BAD_INV_ORDER- if the caller has invoked operations in the wrong order
- See Also:
- CORBApackage comments for unimplemented features
 
 - 
insert_Streamablepublic void insert_Streamable(Streamable s) Inserts the givenStreamableobject into thisAnyobject'svaluefield. This method allows the insertion of non-primitive IDL types.- Parameters:
- s- the- Streamableobject to insert into this- Anyobject; may be a non-primitive IDL type
- See Also:
- CORBApackage comments for unimplemented features
 
 - 
extract_fixedpublic BigDecimal extract_fixed() Extracts thejava.math.BigDecimalobject in thisAnyobject'svaluefield.- Returns:
- the java.math.BigDecimalobject stored in thisAnyobject
- Throws:
- BAD_OPERATION- if this- Anyobject contains something other than a- java.math.BigDecimalobject or the- valuefield has not yet been set
- See Also:
- CORBApackage comments for unimplemented features
 
 - 
insert_fixedpublic void insert_fixed(BigDecimal value) Throws anorg.omg.CORBA.NO_IMPLEMENTexception.Inserts the given java.math.BigDecimalobject into thisAnyobject'svaluefield.- Parameters:
- value- the- java.math.BigDecimalobject to insert into this- Anyobject
- See Also:
- CORBApackage comments for unimplemented features
 
 - 
insert_fixedpublic void insert_fixed(BigDecimal value, TypeCode type) throws BAD_INV_ORDER Throws anorg.omg.CORBA.NO_IMPLEMENTexception.Inserts the given java.math.BigDecimalobject into thisAnyobject'svaluefield.- Parameters:
- value- the- java.math.BigDecimalobject to insert into this- Anyobject
- type- the- TypeCodeobject that is to be inserted into this- Anyobject's- typefield and that describes the- java.math.BigDecimalobject being inserted
- Throws:
- BAD_INV_ORDER- if this method is invoked improperly
- See Also:
- CORBApackage comments for unimplemented features
 
 
- 
 
-