Any (Java Platform SE 6)
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.
For a given primitive type X, these methods are:
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.
- Since:
- JDK1.2
| Constructor Summary | |
|---|---|
Any()
|
|
| Method Summary | |
|---|---|
abstract InputStream |
create_input_stream()
Creates an input stream from which this Any object's value
can be unmarshalled. |
abstract OutputStream |
create_output_stream()
Creates an output stream into which this Any object's
value can be marshalled. |
abstract boolean |
equal(Any a)
Checks for equality between this Any object and the
given Any object. |
abstract Any |
extract_any()
Extracts the Any object in this
Any object's value field. |
abstract boolean |
extract_boolean()
Extracts the boolean in this
Any object's value field. |
abstract char |
extract_char()
Extracts the char in this
Any object's value field. |
abstract double |
extract_double()
Extracts the double in this
Any object's value field. |
BigDecimal |
extract_fixed()
Extracts the java.math.BigDecimal object in this
Any object's value field. |
abstract float |
extract_float()
Extracts the float in this
Any object's value field. |
abstract int |
extract_long()
Extracts the int in this
Any object's value field. |
abstract long |
extract_longlong()
Extracts the long in this
Any object's value field. |
abstract Object |
extract_Object()
Extracts the org.omg.CORBA.Object in this
Any object's value field. |
abstract byte |
extract_octet()
Extracts the byte in this
Any object's value field. |
Principal |
extract_Principal()
Deprecated. Deprecated by CORBA 2.2. |
abstract short |
extract_short()
Extracts the short in this
Any object's value field. |
Streamable |
extract_Streamable()
Extracts a Streamable from this Any object's
value field. |
abstract String |
extract_string()
Extracts the String object in this
Any object's value field. |
abstract TypeCode |
extract_TypeCode()
Extracts the TypeCode object in this
Any object's value field. |
abstract int |
extract_ulong()
Extracts the int in this
Any object's value field. |
abstract long |
extract_ulonglong()
Extracts the long in this
Any object's value field. |
abstract short |
extract_ushort()
Extracts the short in this
Any object's value field. |
abstract Serializable |
extract_Value()
Extracts the java.io.Serializable object in this
Any object's value field. |
abstract char |
extract_wchar()
Extracts the char in this
Any object's value field. |
abstract String |
extract_wstring()
Extracts the String object in this
Any object's value field. |
abstract void |
insert_any(Any a)
Inserts the given Any object
into this Any object's value field. |
abstract void |
insert_boolean(boolean b)
Inserts the given boolean
into this Any object's value field. |
abstract void |
insert_char(char c)
Inserts the given char
into this Any object's value field. |
abstract void |
insert_double(double d)
Inserts the given double
into this Any object's value field. |
void |
insert_fixed(BigDecimal value)
Throws an org.omg.CORBA.NO_IMPLEMENT exception. |
void |
insert_fixed(BigDecimal value,
TypeCode type)
Throws an org.omg.CORBA.NO_IMPLEMENT exception. |
abstract void |
insert_float(float f)
Inserts the given float
into this Any object's value field. |
abstract void |
insert_long(int l)
Inserts the given int
into this Any object's value field. |
abstract void |
insert_longlong(long l)
Inserts the given long
into this Any object's value field. |
abstract void |
insert_Object(Object o)
Inserts the given org.omg.CORBA.Object object
into this Any object's value field. |
abstract void |
insert_Object(Object o,
TypeCode t)
Inserts the given org.omg.CORBA.Object object
into this Any object's value field. |
abstract void |
insert_octet(byte b)
Inserts the given byte
into this Any object's value field. |
void |
insert_Principal(Principal p)
Deprecated. Deprecated by CORBA 2.2. |
abstract void |
insert_short(short s)
Inserts the given short
into this Any object's value field. |
void |
insert_Streamable(Streamable s)
Inserts the given Streamable object
into this Any object's value field. |
abstract void |
insert_string(String s)
Inserts the given String object
into this Any object's value field. |
abstract void |
insert_TypeCode(TypeCode t)
Inserts the given TypeCode object
into this Any object's value field. |
abstract void |
insert_ulong(int l)
Inserts the given int
into this Any object's value field. |
abstract void |
insert_ulonglong(long l)
Inserts the given long
into this Any object's value field. |
abstract void |
insert_ushort(short s)
Inserts the given short
into this Any object's value field. |
abstract void |
insert_Value(Serializable v)
Inserts the given java.io.Serializable object
into this Any object's value field. |
abstract void |
insert_Value(Serializable v,
TypeCode t)
Inserts the given java.io.Serializable object
into this Any object's value field. |
abstract void |
insert_wchar(char c)
Inserts the given char
into this Any object's value field. |
abstract void |
insert_wstring(String s)
Inserts the given String object
into this Any object's value field. |
abstract void |
read_value(InputStream is,
TypeCode t)
Reads off (unmarshals) the value of an Any object from
the given input stream using the given typecode. |
abstract TypeCode |
type()
Returns type information for the element contained in this Any object. |
abstract void |
type(TypeCode t)
Sets this Any object's type field
to the given TypeCode object and clears its value. |
abstract void |
write_value(OutputStream os)
Writes out the value of this Any object
to the given output stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
Any
public Any()
| Method Detail |
|---|
equal
public abstract boolean equal(Any a)
- Checks for equality between this
Anyobject and the givenAnyobject. TwoAnyobjects are equal if both their values and type codes are equal. - Parameters:
a- theAnyobject to test for equality- Returns:
trueif theAnyobjects are equal;falseotherwise- See Also:
CORBApackage comments for unimplemented features
type
public abstract TypeCode type()
- Returns type information for the element contained in this
Anyobject. - Returns:
- the
TypeCodeobject containing type information about the value contained in thisAnyobject
type
public abstract void type(TypeCode t)
- Sets this
Anyobject'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- theTypeCodeobject giving information for the value in thisAnyobject
read_value
public abstract void read_value(InputStream is, TypeCode t) throws MARSHAL
- Reads off (unmarshals) the value of an
Anyobject from the given input stream using the given typecode. - Parameters:
is- theorg.omg.CORBA.portable.InputStreamobject from which to read the value contained in thisAnyobjectt- aTypeCodeobject containing type information about the value to be read- Throws:
MARSHAL- when the givenTypeCodeobject is not consistent with the value that was contained in the input stream
write_value
public abstract void write_value(OutputStream os)
- Writes out the value of this
Anyobject 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- theorg.omg.CORBA.portable.OutputStreamobject into which to marshal the value of thisAnyobject
create_output_stream
public abstract OutputStream create_output_stream()
- Creates an output stream into which this
Anyobject's value can be marshalled. - Returns:
- the newly-created
OutputStream
create_input_stream
public abstract InputStream create_input_stream()
- Creates an input stream from which this
Anyobject's value can be unmarshalled. - Returns:
- the newly-created
InputStream
extract_short
public abstract short extract_short()
throws BAD_OPERATION
- Extracts the
shortin thisAnyobject'svaluefield. - Returns:
- the
shortstored in thisAnyobject - Throws:
BAD_OPERATION- if thisAnyobject contains something other than ashortor thevaluefield has not yet been set
insert_short
public abstract void insert_short(short s)
- Inserts the given
shortinto thisAnyobject'svaluefield. - Parameters:
s- theshortto insert into thisAnyobject
extract_long
public abstract int extract_long()
throws BAD_OPERATION
- Extracts the
intin thisAnyobject'svaluefield. - Returns:
- the
intstored in thisAnyobject - Throws:
BAD_OPERATION- if thisAnyobject contains something other than anintor thevaluefield has not yet been set
insert_long
public abstract void insert_long(int l)
- Inserts the given
intinto thisAnyobject'svaluefield. - Parameters:
l- theintto insert into thisAnyobject
extract_longlong
public abstract long extract_longlong()
throws BAD_OPERATION
- Extracts the
longin thisAnyobject'svaluefield. - Returns:
- the
longstored in thisAnyobject - Throws:
BAD_OPERATION- if thisAnyobject contains something other than alongor thevaluefield has not yet been set
insert_longlong
public abstract void insert_longlong(long l)
- Inserts the given
longinto thisAnyobject'svaluefield. - Parameters:
l- thelongto insert into thisAnyobject
extract_ushort
public abstract short extract_ushort()
throws BAD_OPERATION
- Extracts the
shortin thisAnyobject'svaluefield. - Returns:
- the
shortstored in thisAnyobject - Throws:
BAD_OPERATION- if thisAnyobject contains something other than ashortor thevaluefield has not yet been set
insert_ushort
public abstract void insert_ushort(short s)
- Inserts the given
shortinto thisAnyobject'svaluefield. - Parameters:
s- theshortto insert into thisAnyobject
extract_ulong
public abstract int extract_ulong()
throws BAD_OPERATION
- Extracts the
intin thisAnyobject'svaluefield. - Returns:
- the
intstored in thisAnyobject - Throws:
BAD_OPERATION- if thisAnyobject contains something other than anintor thevaluefield has not yet been set
insert_ulong
public abstract void insert_ulong(int l)
- Inserts the given
intinto thisAnyobject'svaluefield. - Parameters:
l- theintto insert into thisAnyobject
extract_ulonglong
public abstract long extract_ulonglong()
throws BAD_OPERATION
- Extracts the
longin thisAnyobject'svaluefield. - Returns:
- the
longstored in thisAnyobject - Throws:
BAD_OPERATION- if thisAnyobject contains something other than alongor thevaluefield has not yet been set
insert_ulonglong
public abstract void insert_ulonglong(long l)
- Inserts the given
longinto thisAnyobject'svaluefield. - Parameters:
l- thelongto insert into thisAnyobject
extract_float
public abstract float extract_float()
throws BAD_OPERATION
- Extracts the
floatin thisAnyobject'svaluefield. - Returns:
- the
floatstored in thisAnyobject - Throws:
BAD_OPERATION- if thisAnyobject contains something other than afloator thevaluefield has not yet been set
insert_float
public abstract void insert_float(float f)
- Inserts the given
floatinto thisAnyobject'svaluefield. - Parameters:
f- thefloatto insert into thisAnyobject
extract_double
public abstract double extract_double()
throws BAD_OPERATION
- Extracts the
doublein thisAnyobject'svaluefield. - Returns:
- the
doublestored in thisAnyobject - Throws:
BAD_OPERATION- if thisAnyobject contains something other than adoubleor thevaluefield has not yet been set
insert_double
public abstract void insert_double(double d)
- Inserts the given
doubleinto thisAnyobject'svaluefield. - Parameters:
d- thedoubleto insert into thisAnyobject
extract_boolean
public abstract boolean extract_boolean()
throws BAD_OPERATION
- Extracts the
booleanin thisAnyobject'svaluefield. - Returns:
- the
booleanstored in thisAnyobject - Throws:
BAD_OPERATION- if thisAnyobject contains something other than abooleanor thevaluefield has not yet been set
insert_boolean
public abstract void insert_boolean(boolean b)
- Inserts the given
booleaninto thisAnyobject'svaluefield. - Parameters:
b- thebooleanto insert into thisAnyobject
extract_char
public abstract char extract_char()
throws BAD_OPERATION
- Extracts the
charin thisAnyobject'svaluefield. - Returns:
- the
charstored in thisAnyobject - Throws:
BAD_OPERATION- if thisAnyobject contains something other than acharor thevaluefield has not yet been set
insert_char
public abstract void insert_char(char c)
throws DATA_CONVERSION
- Inserts the given
charinto thisAnyobject'svaluefield. - Parameters:
c- thecharto insert into thisAnyobject- Throws:
DATA_CONVERSION- if there is a data conversion error
extract_wchar
public abstract char extract_wchar()
throws BAD_OPERATION
- Extracts the
charin thisAnyobject'svaluefield. - Returns:
- the
charstored in thisAnyobject - Throws:
BAD_OPERATION- if thisAnyobject contains something other than acharor thevaluefield has not yet been set
insert_wchar
public abstract void insert_wchar(char c)
- Inserts the given
charinto thisAnyobject'svaluefield. - Parameters:
c- thecharto insert into thisAnyobject
extract_octet
public abstract byte extract_octet()
throws BAD_OPERATION
- Extracts the
bytein thisAnyobject'svaluefield. - Returns:
- the
bytestored in thisAnyobject - Throws:
BAD_OPERATION- if thisAnyobject contains something other than abyteor thevaluefield has not yet been set
insert_octet
public abstract void insert_octet(byte b)
- Inserts the given
byteinto thisAnyobject'svaluefield. - Parameters:
b- thebyteto insert into thisAnyobject
extract_any
public abstract Any extract_any() throws BAD_OPERATION
- Extracts the
Anyobject in thisAnyobject'svaluefield. - Returns:
- the
Anyobject stored in thisAnyobject - Throws:
BAD_OPERATION- if thisAnyobject contains something other than anAnyobject or thevaluefield has not yet been set
insert_any
public abstract void insert_any(Any a)
- Inserts the given
Anyobject into thisAnyobject'svaluefield. - Parameters:
a- theAnyobject to insert into thisAnyobject
extract_Object
public abstract Object extract_Object() throws BAD_OPERATION
- Extracts the
org.omg.CORBA.Objectin thisAnyobject'svaluefield. - Returns:
- the
org.omg.CORBA.Objectstored in thisAnyobject - Throws:
BAD_OPERATION- if thisAnyobject contains something other than anorg.omg.CORBA.Objector thevaluefield has not yet been set
insert_Object
public abstract void insert_Object(Object o)
- Inserts the given
org.omg.CORBA.Objectobject into thisAnyobject'svaluefield. - Parameters:
o- theorg.omg.CORBA.Objectobject to insert into thisAnyobject
extract_Value
public abstract Serializable extract_Value() throws BAD_OPERATION
- Extracts the
java.io.Serializableobject in thisAnyobject'svaluefield. - Returns:
- the
java.io.Serializableobject stored in thisAnyobject - Throws:
BAD_OPERATION- if thisAnyobject contains something other than ajava.io.Serializableobject or thevaluefield has not yet been set
insert_Value
public abstract void insert_Value(Serializable v)
- Inserts the given
java.io.Serializableobject into thisAnyobject'svaluefield. - Parameters:
v- thejava.io.Serializableobject to insert into thisAnyobject
insert_Value
public abstract void insert_Value(Serializable v, TypeCode t) throws MARSHAL
- Inserts the given
java.io.Serializableobject into thisAnyobject'svaluefield. - Parameters:
v- thejava.io.Serializableobject to insert into thisAnyobjectt- theTypeCodeobject that is to be inserted into thisAnyobject'stypefield and that describes thejava.io.Serializableobject being inserted- Throws:
MARSHAL- if the ORB has a problem marshalling or unmarshalling parameters
insert_Object
public abstract void insert_Object(Object o, TypeCode t) throws BAD_PARAM
- Inserts the given
org.omg.CORBA.Objectobject into thisAnyobject'svaluefield. - Parameters:
o- theorg.omg.CORBA.Objectinstance to insert into thisAnyobjectt- theTypeCodeobject that is to be inserted into thisAnyobject and that describes theObjectbeing inserted- Throws:
BAD_OPERATION- if this method is invalid for thisAnyobjectBAD_PARAM
extract_string
public abstract String extract_string() throws BAD_OPERATION
- Extracts the
Stringobject in thisAnyobject'svaluefield. - Returns:
- the
Stringobject stored in thisAnyobject - Throws:
BAD_OPERATION- if thisAnyobject contains something other than aStringobject or thevaluefield has not yet been set
insert_string
public abstract void insert_string(String s) throws DATA_CONVERSION, MARSHAL
- Inserts the given
Stringobject into thisAnyobject'svaluefield. - Parameters:
s- theStringobject to insert into thisAnyobject- Throws:
DATA_CONVERSION- if there is a data conversion errorMARSHAL- if the ORB has a problem marshalling or unmarshalling parameters
extract_wstring
public abstract String extract_wstring() throws BAD_OPERATION
- Extracts the
Stringobject in thisAnyobject'svaluefield. - Returns:
- the
Stringobject stored in thisAnyobject - Throws:
BAD_OPERATION- if thisAnyobject contains something other than aStringobject or thevaluefield has not yet been set
insert_wstring
public abstract void insert_wstring(String s) throws MARSHAL
- Inserts the given
Stringobject into thisAnyobject'svaluefield. - Parameters:
s- theStringobject to insert into thisAnyobject- Throws:
MARSHAL- if the ORB has a problem marshalling or unmarshalling parameters
extract_TypeCode
public abstract TypeCode extract_TypeCode() throws BAD_OPERATION
- Extracts the
TypeCodeobject in thisAnyobject'svaluefield. - Returns:
- the
TypeCodeobject stored in thisAnyobject - Throws:
BAD_OPERATION- if thisAnyobject contains something other than aTypeCodeobject or thevaluefield has not yet been set
insert_TypeCode
public abstract void insert_TypeCode(TypeCode t)
- Inserts the given
TypeCodeobject into thisAnyobject'svaluefield. - Parameters:
t- theTypeCodeobject to insert into thisAnyobject
extract_Principal
@Deprecated public Principal extract_Principal() throws BAD_OPERATION
- Deprecated. Deprecated by CORBA 2.2.
- Extracts the
Principalobject in thisAnyobject'svaluefield. Note that the classPrincipalhas been deprecated. - Returns:
- the
Principalobject stored in thisAnyobject - Throws:
BAD_OPERATION- if thisAnyobject contains something other than aPrincipalobject or thevaluefield 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 given
Principalobject into thisAnyobject'svaluefield. Note that the classPrincipalhas been deprecated. - Parameters:
p- thePrincipalobject to insert into thisAnyobject- See Also:
CORBApackage comments for unimplemented features
extract_Streamable
public Streamable extract_Streamable() throws BAD_INV_ORDER
- Extracts a
Streamablefrom 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_Streamable
public void insert_Streamable(Streamable s)
- Inserts the given
Streamableobject into thisAnyobject'svaluefield. This method allows the insertion of non-primitive IDL types. - Parameters:
s- theStreamableobject to insert into thisAnyobject; may be a non-primitive IDL type- See Also:
CORBApackage comments for unimplemented features
extract_fixed
public BigDecimal extract_fixed()
- Extracts the
java.math.BigDecimalobject in thisAnyobject'svaluefield. - Returns:
- the
java.math.BigDecimalobject stored in thisAnyobject - Throws:
BAD_OPERATION- if thisAnyobject contains something other than ajava.math.BigDecimalobject or thevaluefield has not yet been set- See Also:
CORBApackage comments for unimplemented features
insert_fixed
public void insert_fixed(BigDecimal value)
- Throws an
org.omg.CORBA.NO_IMPLEMENTexception.Inserts the given
java.math.BigDecimalobject into thisAnyobject'svaluefield. - Parameters:
value- thejava.math.BigDecimalobject to insert into thisAnyobject- See Also:
CORBApackage comments for unimplemented features
insert_fixed
public void insert_fixed(BigDecimal value, TypeCode type) throws BAD_INV_ORDER
- Throws an
org.omg.CORBA.NO_IMPLEMENTexception.Inserts the given
java.math.BigDecimalobject into thisAnyobject'svaluefield. - Parameters:
value- thejava.math.BigDecimalobject to insert into thisAnyobjecttype- theTypeCodeobject that is to be inserted into thisAnyobject'stypefield and that describes thejava.math.BigDecimalobject being inserted- Throws:
BAD_INV_ORDER- if this method is invoked improperly- See Also:
CORBApackage comments for unimplemented features
Submit a bug or feature
For further API reference and developer documentation, see Java SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2015, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.