Class Any
- 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. 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:
- a data value
- a
TypeCode
object describing the type of the data value contained in theAny
object. For example, aTypeCode
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 theTypeCode
object is itself aTypeCode
object.)
- Since:
- JDK1.2
Constructors
Constructor and Description |
---|
Any() |
Methods
Modifier and Type | Method and Description |
---|---|
abstract InputStream |
create_input_stream() Creates an input stream from which this |
abstract OutputStream |
create_output_stream() Creates an output stream into which this |
abstract boolean |
equal(Any a) Checks for equality between this |
abstract Any |
extract_any() Extracts the |
abstract boolean |
extract_boolean() Extracts the |
abstract char |
extract_char() Extracts the |
abstract double |
extract_double() Extracts the |
BigDecimal |
extract_fixed() Extracts the |
abstract float |
extract_float() Extracts the |
abstract int |
extract_long() Extracts the |
abstract long |
extract_longlong() Extracts the |
abstract Object |
extract_Object() Extracts the |
abstract byte |
extract_octet() Extracts the |
Principal |
extract_Principal() Deprecated. Deprecated by CORBA 2.2. |
abstract short |
extract_short() Extracts the |
Streamable |
extract_Streamable() Extracts a |
abstract String |
extract_string() Extracts the |
abstract TypeCode |
extract_TypeCode() Extracts the |
abstract int |
extract_ulong() Extracts the |
abstract long |
extract_ulonglong() Extracts the |
abstract short |
extract_ushort() Extracts the |
abstract Serializable |
extract_Value() Extracts the |
abstract char |
extract_wchar() Extracts the |
abstract String |
extract_wstring() Extracts the |
abstract void |
insert_any(Any a) Inserts the given |
abstract void |
insert_boolean(boolean b) Inserts the given |
abstract void |
insert_char(char c) Inserts the given |
abstract void |
insert_double(double d) Inserts the given |
void |
insert_fixed(BigDecimal value) Throws an |
void |
insert_fixed(BigDecimal value,
TypeCode type) Throws an |
abstract void |
insert_float(float f) Inserts the given |
abstract void |
insert_long(int l) Inserts the given |
abstract void |
insert_longlong(long l) Inserts the given |
abstract void |
insert_Object(Object o) Inserts the given |
abstract void |
insert_Object(Object o,
TypeCode t) Inserts the given |
abstract void |
insert_octet(byte b) Inserts the given |
void |
insert_Principal(Principal p) Deprecated. Deprecated by CORBA 2.2. |
abstract void |
insert_short(short s) Inserts the given |
void |
insert_Streamable(Streamable s) Inserts the given |
abstract void |
insert_string(String s) Inserts the given |
abstract void |
insert_TypeCode(TypeCode t) Inserts the given |
abstract void |
insert_ulong(int l) Inserts the given |
abstract void |
insert_ulonglong(long l) Inserts the given |
abstract void |
insert_ushort(short s) Inserts the given |
abstract void |
insert_Value(Serializable v) Inserts the given |
abstract void |
insert_Value(Serializable v,
TypeCode t) Inserts the given |
abstract void |
insert_wchar(char c) Inserts the given |
abstract void |
insert_wstring(String s) Inserts the given |
abstract void |
read_value(InputStream is,
TypeCode t) Reads off (unmarshals) the value of an |
abstract TypeCode |
type() Returns type information for the element contained in this |
abstract void |
type(TypeCode t) Sets this |
abstract void |
write_value(OutputStream os) Writes out the value of this |
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructors
Any
public Any()
Methods
equal
public abstract boolean equal(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.
- Parameters:
-
a
- theAny
object to test for equality - Returns:
-
true
if theAny
objects are equal;false
otherwise - See Also:
CORBA
package comments for unimplemented features
type
public abstract TypeCode type()
Returns type information for the element contained in this Any
object.
- Returns:
- the
TypeCode
object containing type information about the value contained in thisAny
object
type
public abstract void type(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.
- Parameters:
-
t
- theTypeCode
object giving information for the value in thisAny
object
read_value
public abstract void read_value(InputStream is, TypeCode t) throws MARSHAL
Reads off (unmarshals) the value of an Any
object from the given input stream using the given typecode.
- Parameters:
-
is
- theorg.omg.CORBA.portable.InputStream
object from which to read the value contained in thisAny
object -
t
- aTypeCode
object containing type information about the value to be read - Throws:
-
MARSHAL
- when the givenTypeCode
object 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 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
.
- Parameters:
-
os
- theorg.omg.CORBA.portable.OutputStream
object into which to marshal the value of thisAny
object
create_output_stream
public abstract OutputStream create_output_stream()
Creates an output stream into which this Any
object'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 Any
object's value can be unmarshalled.
- Returns:
- the newly-created
InputStream
extract_short
public abstract short extract_short() throws BAD_OPERATION
Extracts the short
in this Any
object's value
field.
- Returns:
- the
short
stored in thisAny
object - Throws:
-
BAD_OPERATION
- if thisAny
object contains something other than ashort
or thevalue
field has not yet been set
insert_short
public abstract void insert_short(short s)
Inserts the given short
into this Any
object's value
field.
- Parameters:
-
s
- theshort
to insert into thisAny
object
extract_long
public abstract int extract_long() throws BAD_OPERATION
Extracts the int
in this Any
object's value
field.
- Returns:
- the
int
stored in thisAny
object - Throws:
-
BAD_OPERATION
- if thisAny
object contains something other than anint
or thevalue
field has not yet been set
insert_long
public abstract void insert_long(int l)
Inserts the given int
into this Any
object's value
field.
- Parameters:
-
l
- theint
to insert into thisAny
object
extract_longlong
public abstract long extract_longlong() throws BAD_OPERATION
Extracts the long
in this Any
object's value
field.
- Returns:
- the
long
stored in thisAny
object - Throws:
-
BAD_OPERATION
- if thisAny
object contains something other than along
or thevalue
field has not yet been set
insert_longlong
public abstract void insert_longlong(long l)
Inserts the given long
into this Any
object's value
field.
- Parameters:
-
l
- thelong
to insert into thisAny
object
extract_ushort
public abstract short extract_ushort() throws BAD_OPERATION
Extracts the short
in this Any
object's value
field.
- Returns:
- the
short
stored in thisAny
object - Throws:
-
BAD_OPERATION
- if thisAny
object contains something other than ashort
or thevalue
field has not yet been set
insert_ushort
public abstract void insert_ushort(short s)
Inserts the given short
into this Any
object's value
field.
- Parameters:
-
s
- theshort
to insert into thisAny
object
extract_ulong
public abstract int extract_ulong() throws BAD_OPERATION
Extracts the int
in this Any
object's value
field.
- Returns:
- the
int
stored in thisAny
object - Throws:
-
BAD_OPERATION
- if thisAny
object contains something other than anint
or thevalue
field has not yet been set
insert_ulong
public abstract void insert_ulong(int l)
Inserts the given int
into this Any
object's value
field.
- Parameters:
-
l
- theint
to insert into thisAny
object
extract_ulonglong
public abstract long extract_ulonglong() throws BAD_OPERATION
Extracts the long
in this Any
object's value
field.
- Returns:
- the
long
stored in thisAny
object - Throws:
-
BAD_OPERATION
- if thisAny
object contains something other than along
or thevalue
field has not yet been set
insert_ulonglong
public abstract void insert_ulonglong(long l)
Inserts the given long
into this Any
object's value
field.
- Parameters:
-
l
- thelong
to insert into thisAny
object
extract_float
public abstract float extract_float() throws BAD_OPERATION
Extracts the float
in this Any
object's value
field.
- Returns:
- the
float
stored in thisAny
object - Throws:
-
BAD_OPERATION
- if thisAny
object contains something other than afloat
or thevalue
field has not yet been set
insert_float
public abstract void insert_float(float f)
Inserts the given float
into this Any
object's value
field.
- Parameters:
-
f
- thefloat
to insert into thisAny
object
extract_double
public abstract double extract_double() throws BAD_OPERATION
Extracts the double
in this Any
object's value
field.
- Returns:
- the
double
stored in thisAny
object - Throws:
-
BAD_OPERATION
- if thisAny
object contains something other than adouble
or thevalue
field has not yet been set
insert_double
public abstract void insert_double(double d)
Inserts the given double
into this Any
object's value
field.
- Parameters:
-
d
- thedouble
to insert into thisAny
object
extract_boolean
public abstract boolean extract_boolean() throws BAD_OPERATION
Extracts the boolean
in this Any
object's value
field.
- Returns:
- the
boolean
stored in thisAny
object - Throws:
-
BAD_OPERATION
- if thisAny
object contains something other than aboolean
or thevalue
field has not yet been set
insert_boolean
public abstract void insert_boolean(boolean b)
Inserts the given boolean
into this Any
object's value
field.
- Parameters:
-
b
- theboolean
to insert into thisAny
object
extract_char
public abstract char extract_char() throws BAD_OPERATION
Extracts the char
in this Any
object's value
field.
- Returns:
- the
char
stored in thisAny
object - Throws:
-
BAD_OPERATION
- if thisAny
object contains something other than achar
or thevalue
field has not yet been set
insert_char
public abstract void insert_char(char c) throws DATA_CONVERSION
Inserts the given char
into this Any
object's value
field.
- Parameters:
-
c
- thechar
to insert into thisAny
object - Throws:
-
DATA_CONVERSION
- if there is a data conversion error
extract_wchar
public abstract char extract_wchar() throws BAD_OPERATION
Extracts the char
in this Any
object's value
field.
- Returns:
- the
char
stored in thisAny
object - Throws:
-
BAD_OPERATION
- if thisAny
object contains something other than achar
or thevalue
field has not yet been set
insert_wchar
public abstract void insert_wchar(char c)
Inserts the given char
into this Any
object's value
field.
- Parameters:
-
c
- thechar
to insert into thisAny
object
extract_octet
public abstract byte extract_octet() throws BAD_OPERATION
Extracts the byte
in this Any
object's value
field.
- Returns:
- the
byte
stored in thisAny
object - Throws:
-
BAD_OPERATION
- if thisAny
object contains something other than abyte
or thevalue
field has not yet been set
insert_octet
public abstract void insert_octet(byte b)
Inserts the given byte
into this Any
object's value
field.
- Parameters:
-
b
- thebyte
to insert into thisAny
object
extract_any
public abstract Any extract_any() throws BAD_OPERATION
Extracts the Any
object in this Any
object's value
field.
- Returns:
- the
Any
object stored in thisAny
object - Throws:
-
BAD_OPERATION
- if thisAny
object contains something other than anAny
object or thevalue
field has not yet been set
insert_any
public abstract void insert_any(Any a)
Inserts the given Any
object into this Any
object's value
field.
- Parameters:
-
a
- theAny
object to insert into thisAny
object
extract_Object
public abstract Object extract_Object() throws BAD_OPERATION
Extracts the org.omg.CORBA.Object
in this Any
object's value
field.
- Returns:
- the
org.omg.CORBA.Object
stored in thisAny
object - Throws:
-
BAD_OPERATION
- if thisAny
object contains something other than anorg.omg.CORBA.Object
or thevalue
field has not yet been set
insert_Object
public abstract void insert_Object(Object o)
Inserts the given org.omg.CORBA.Object
object into this Any
object's value
field.
- Parameters:
-
o
- theorg.omg.CORBA.Object
object to insert into thisAny
object
extract_Value
public abstract Serializable extract_Value() throws BAD_OPERATION
Extracts the java.io.Serializable
object in this Any
object's value
field.
- Returns:
- the
java.io.Serializable
object stored in thisAny
object - Throws:
-
BAD_OPERATION
- if thisAny
object contains something other than ajava.io.Serializable
object or thevalue
field has not yet been set
insert_Value
public abstract void insert_Value(Serializable v)
Inserts the given java.io.Serializable
object into this Any
object's value
field.
- Parameters:
-
v
- thejava.io.Serializable
object to insert into thisAny
object
insert_Value
public abstract void insert_Value(Serializable v, TypeCode t) throws MARSHAL
Inserts the given java.io.Serializable
object into this Any
object's value
field.
- Parameters:
-
v
- thejava.io.Serializable
object to insert into thisAny
object -
t
- theTypeCode
object that is to be inserted into thisAny
object'stype
field and that describes thejava.io.Serializable
object 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.Object
object into this Any
object's value
field.
- Parameters:
-
o
- theorg.omg.CORBA.Object
instance to insert into thisAny
object -
t
- theTypeCode
object that is to be inserted into thisAny
object and that describes theObject
being inserted - Throws:
-
BAD_OPERATION
- if this method is invalid for thisAny
object BAD_PARAM
extract_string
public abstract String extract_string() throws BAD_OPERATION
Extracts the String
object in this Any
object's value
field.
- Returns:
- the
String
object stored in thisAny
object - Throws:
-
BAD_OPERATION
- if thisAny
object contains something other than aString
object or thevalue
field has not yet been set
insert_string
public abstract void insert_string(String s) throws DATA_CONVERSION, MARSHAL
Inserts the given String
object into this Any
object's value
field.
- Parameters:
-
s
- theString
object to insert into thisAny
object - Throws:
-
DATA_CONVERSION
- if there is a data conversion error -
MARSHAL
- if the ORB has a problem marshalling or unmarshalling parameters
extract_wstring
public abstract String extract_wstring() throws BAD_OPERATION
Extracts the String
object in this Any
object's value
field.
- Returns:
- the
String
object stored in thisAny
object - Throws:
-
BAD_OPERATION
- if thisAny
object contains something other than aString
object or thevalue
field has not yet been set
insert_wstring
public abstract void insert_wstring(String s) throws MARSHAL
Inserts the given String
object into this Any
object's value
field.
- Parameters:
-
s
- theString
object to insert into thisAny
object - Throws:
-
MARSHAL
- if the ORB has a problem marshalling or unmarshalling parameters
extract_TypeCode
public abstract TypeCode extract_TypeCode() throws BAD_OPERATION
Extracts the TypeCode
object in this Any
object's value
field.
- Returns:
- the
TypeCode
object stored in thisAny
object - Throws:
-
BAD_OPERATION
- if thisAny
object contains something other than aTypeCode
object or thevalue
field has not yet been set
insert_TypeCode
public abstract void insert_TypeCode(TypeCode t)
Inserts the given TypeCode
object into this Any
object's value
field.
- Parameters:
-
t
- theTypeCode
object to insert into thisAny
object
extract_Principal
@Deprecated public Principal extract_Principal() throws BAD_OPERATION
Deprecated. Deprecated by CORBA 2.2.
Extracts the Principal
object in this Any
object's value
field. Note that the class Principal
has been deprecated.
- Returns:
- the
Principal
object stored in thisAny
object - Throws:
-
BAD_OPERATION
- if thisAny
object contains something other than aPrincipal
object or thevalue
field has not yet been set - See Also:
CORBA
package comments for unimplemented features
insert_Principal
@Deprecated public void insert_Principal(Principal p)
Deprecated. Deprecated by CORBA 2.2.
Inserts the given Principal
object into this Any
object's value
field. Note that the class Principal
has been deprecated.
- Parameters:
-
p
- thePrincipal
object to insert into thisAny
object - See Also:
CORBA
package comments for unimplemented features
extract_Streamable
public Streamable extract_Streamable() throws BAD_INV_ORDER
Extracts a Streamable
from this Any
object's value
field. This method allows the extraction of non-primitive IDL types.
- Returns:
- the
Streamable
stored in theAny
object. - Throws:
-
BAD_INV_ORDER
- if the caller has invoked operations in the wrong order - See Also:
CORBA
package comments for unimplemented features
insert_Streamable
public void insert_Streamable(Streamable s)
Inserts the given Streamable
object into this Any
object's value
field. This method allows the insertion of non-primitive IDL types.
- Parameters:
-
s
- theStreamable
object to insert into thisAny
object; may be a non-primitive IDL type - See Also:
CORBA
package comments for unimplemented features
extract_fixed
public BigDecimal extract_fixed()
Extracts the java.math.BigDecimal
object in this Any
object's value
field.
- Returns:
- the
java.math.BigDecimal
object stored in thisAny
object - Throws:
-
BAD_OPERATION
- if thisAny
object contains something other than ajava.math.BigDecimal
object or thevalue
field has not yet been set - See Also:
CORBA
package comments for unimplemented features
insert_fixed
public void insert_fixed(BigDecimal value)
Throws an org.omg.CORBA.NO_IMPLEMENT
exception.
Inserts the given java.math.BigDecimal
object into this Any
object's value
field.
- Parameters:
-
value
- thejava.math.BigDecimal
object to insert into thisAny
object - See Also:
CORBA
package comments for unimplemented features
insert_fixed
public void insert_fixed(BigDecimal value, TypeCode type) throws BAD_INV_ORDER
Throws an org.omg.CORBA.NO_IMPLEMENT
exception.
Inserts the given java.math.BigDecimal
object into this Any
object's value
field.
- Parameters:
-
value
- thejava.math.BigDecimal
object to insert into thisAny
object -
type
- theTypeCode
object that is to be inserted into thisAny
object'stype
field and that describes thejava.math.BigDecimal
object being inserted - Throws:
-
BAD_INV_ORDER
- if this method is invoked improperly - See Also:
CORBA
package comments for unimplemented features
© 1993, 2020, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/javase/8/docs/api/org/omg/CORBA/Any.html