Package com.sun.corba.se.impl.dynamicany
Class DynUnionImpl
java.lang.Object
org.omg.CORBA.LocalObject
com.sun.corba.se.impl.dynamicany.DynUnionImpl
- All Implemented Interfaces:
Serializable,Object,IDLEntity,DynAny,DynAnyOperations,DynUnion,DynUnionOperations
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Anyprotected static final DynAny[]protected intprotected static final intprotected ORBprotected static final byteprotected static final byteprotected static final byteprotected static final byteprotected static final byteprotected static final byteprotected static final byteprotected byteprotected static final byteprotected static final byteprotected static final byteprotected ORBUtilSystemException -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDynUnionImpl(ORB orb, Any any, boolean copyValue) protectedDynUnionImpl(ORB orb, TypeCode typeCode) -
Method Summary
Modifier and TypeMethodDescriptionString[]_ids()voidInitializes the value associated with a DynAny object with the value associated with another DynAny object.protected voidprotected booleanprotected voidintReturns the number of components of a DynAny.copy()Creates a new DynAny object whose value is a deep copy of the DynAny on which it is invoked.Returns the DynAny for the component at the current position.voiddestroy()Destroys a DynAny object.Returns the TCKind value of the discriminators TypeCode.booleanCompares two DynAny values for equality.protected DynAnyFactoryfactory()voidInitializes the value associated with a DynAny object with the value contained in an any.get_any()Extracts an Any value contained in the Any represented by this DynAny.booleanExtracts the boolean value from this DynAny.charget_char()Extracts the char value from this DynAny.Returns the current discriminator value.doubleExtracts the double value from this DynAny.Extracts the Any value contained in the Any represented by this DynAny and returns it wrapped into a new DynAny.floatExtracts the float value from this DynAny.intget_long()Extracts the integer value from this DynAny.longExtracts the long value from this DynAny.byteExtracts the byte value from this DynAny.Extracts the reference to a CORBA Object from this DynAny.shortExtracts the short value from this DynAny.Extracts the string value from this DynAny.Extracts the TypeCode object from this DynAny.intExtracts the integer value from this DynAny.longExtracts the long value from this DynAny.shortExtracts the short value from this DynAny.get_val()Extracts a Serializable object from this DynAny.charExtracts the long value from this DynAny.Extracts the string value from this DynAny.protected AnygetAny()protected AnybooleanReturns true if the union has no active member, that is, the unions value consists solely of its discriminator because the discriminator has a value that is not listed as an explicit case label.protected booleanprotected booleanprotected booleanvoidinsert_any(Any value) Inserts an Any value into the Any represented by this DynAny.voidinsert_boolean(boolean value) Inserts a boolean value into the DynAny.voidinsert_char(char value) Inserts a char value into the DynAny.voidinsert_double(double value) Inserts a double value into the DynAny.voidinsert_dyn_any(DynAny value) Inserts the Any value contained in the parameter DynAny into the Any represented by this DynAny.voidinsert_float(float value) Inserts a float value into the DynAny.voidinsert_long(int value) Inserts an integer value into the DynAny.voidinsert_longlong(long value) Inserts a long value into the DynAny.voidinsert_octet(byte value) Inserts a byte value into the DynAny.voidinsert_reference(Object value) Inserts a reference to a CORBA object into the DynAny.voidinsert_short(short value) Inserts a short value into the DynAny.voidinsert_string(String value) Inserts a string value into the DynAny.voidinsert_typecode(TypeCode value) Inserts a TypeCode object into the DynAny.voidinsert_ulong(int value) Inserts an integer value into the DynAny.voidinsert_ulonglong(long value) Inserts a long value into the DynAny.voidinsert_ushort(short value) Inserts a short value into the DynAny.voidinsert_val(Serializable value) Inserts a reference to a Serializable object into this DynAny.voidinsert_wchar(char value) Inserts a char value into the DynAny.voidinsert_wstring(String value) Inserts a string value into the DynAny.protected booleanmember()Returns the currently active member.Returns the TCKind value of the currently active members TypeCode.Returns the name of the currently active member.booleannext()Advances the current position to the next component.voidrewind()Is equivalent to seek(0).booleanseek(int newIndex) Sets the current position to index.voidset_discriminator(DynAny newDiscriminator) Sets the discriminator of the DynUnion to the specified value.voidSets the discriminator to a value that is consistent with the value of the default case of a union.voidSets the discriminator to a value that does not correspond to any of the unions case labels.protected voidsetStatus(byte newStatus) to_any()Creates an any value from a DynAny object.type()Returns the TypeCode associated with this DynAny object.protected voidwriteAny(OutputStream out) Methods inherited from class org.omg.CORBA.LocalObject
_create_request, _create_request, _duplicate, _get_domain_managers, _get_interface, _get_interface_def, _get_policy, _hash, _invoke, _is_a, _is_equivalent, _is_local, _non_existent, _orb, _release, _releaseReply, _request, _request, _servant_postinvoke, _servant_preinvoke, _set_policy_override, validate_connectionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.omg.DynamicAny.DynAnyOperations
assign, component_count, copy, current_component, destroy, equal, from_any, get_any, get_boolean, get_char, get_double, get_dyn_any, get_float, get_long, get_longlong, get_octet, get_reference, get_short, get_string, get_typecode, get_ulong, get_ulonglong, get_ushort, get_val, get_wchar, get_wstring, insert_any, insert_boolean, insert_char, insert_double, insert_dyn_any, insert_float, insert_long, insert_longlong, insert_octet, insert_reference, insert_short, insert_string, insert_typecode, insert_ulong, insert_ulonglong, insert_ushort, insert_val, insert_wchar, insert_wstring, next, rewind, seek, to_any, typeMethods inherited from interface org.omg.CORBA.Object
_create_request, _create_request, _duplicate, _get_domain_managers, _get_interface_def, _get_policy, _hash, _is_a, _is_equivalent, _non_existent, _release, _request, _set_policy_override
-
Field Details
-
REPRESENTATION_NONE
protected static final byte REPRESENTATION_NONE- See Also:
-
REPRESENTATION_TYPECODE
protected static final byte REPRESENTATION_TYPECODE- See Also:
-
REPRESENTATION_ANY
protected static final byte REPRESENTATION_ANY- See Also:
-
REPRESENTATION_COMPONENTS
protected static final byte REPRESENTATION_COMPONENTS- See Also:
-
RECURSIVE_UNDEF
protected static final byte RECURSIVE_UNDEF- See Also:
-
RECURSIVE_NO
protected static final byte RECURSIVE_NO- See Also:
-
RECURSIVE_YES
protected static final byte RECURSIVE_YES- See Also:
-
emptyComponents
-
NO_INDEX
protected static final int NO_INDEX- See Also:
-
STATUS_DESTROYABLE
protected static final byte STATUS_DESTROYABLE- See Also:
-
STATUS_UNDESTROYABLE
protected static final byte STATUS_UNDESTROYABLE- See Also:
-
STATUS_DESTROYED
protected static final byte STATUS_DESTROYED- See Also:
-
orb
-
wrapper
-
any
-
status
protected byte status -
index
protected int index
-
-
Constructor Details
-
DynUnionImpl
-
DynUnionImpl
-
-
Method Details
-
initializeComponentsFromAny
protected boolean initializeComponentsFromAny() -
initializeComponentsFromTypeCode
protected boolean initializeComponentsFromTypeCode() -
clearData
protected void clearData() -
get_discriminator
Returns the current discriminator value.- Specified by:
get_discriminatorin interfaceDynUnionOperations
-
set_discriminator
Description copied from interface:DynUnionOperationsSets the discriminator of the DynUnion to the specified value. Setting the discriminator to a value that is consistent with the currently active union member does not affect the currently active member. Setting the discriminator to a value that is inconsistent with the currently active member deactivates the member and activates the member that is consistent with the new discriminator value (if there is a member for that value) by initializing the member to its default value. Setting the discriminator of a union sets the current position to 0 if the discriminator value indicates a non-existent union member (has_no_active_member returns true in this case). Otherwise, if the discriminator value indicates a named union member, the current position is set to 1 (has_no_active_member returns false and component_count returns 2 in this case).- Specified by:
set_discriminatorin interfaceDynUnionOperations- Throws:
TypeMismatch
-
set_to_default_member
Description copied from interface:DynUnionOperationsSets the discriminator to a value that is consistent with the value of the default case of a union. It sets the current position to zero and causes component_count to return 2.- Specified by:
set_to_default_memberin interfaceDynUnionOperations- Throws:
TypeMismatch
-
set_to_no_active_member
Description copied from interface:DynUnionOperationsSets the discriminator to a value that does not correspond to any of the unions case labels. It sets the current position to zero and causes component_count to return 1.- Specified by:
set_to_no_active_memberin interfaceDynUnionOperations- Throws:
TypeMismatch
-
has_no_active_member
public boolean has_no_active_member()Description copied from interface:DynUnionOperationsReturns true if the union has no active member, that is, the unions value consists solely of its discriminator because the discriminator has a value that is not listed as an explicit case label. Calling this operation on a union that has a default case returns false. Calling this operation on a union that uses the entire range of discriminator values for explicit case labels returns false.- Specified by:
has_no_active_memberin interfaceDynUnionOperations
-
discriminator_kind
Description copied from interface:DynUnionOperationsReturns the TCKind value of the discriminators TypeCode.- Specified by:
discriminator_kindin interfaceDynUnionOperations
-
member
Description copied from interface:DynUnionOperationsReturns the currently active member. Note that the returned reference remains valid only for as long as the currently active member does not change. Using the returned reference beyond the life time of the currently active member raises OBJECT_NOT_EXIST.- Specified by:
memberin interfaceDynUnionOperations- Throws:
InvalidValue
-
member_name
Description copied from interface:DynUnionOperationsReturns the name of the currently active member. If the unions TypeCode does not contain a member name for the currently active member, the operation returns an empty string.- Specified by:
member_namein interfaceDynUnionOperations- Throws:
InvalidValue
-
member_kind
Description copied from interface:DynUnionOperationsReturns the TCKind value of the currently active members TypeCode.- Specified by:
member_kindin interfaceDynUnionOperations- Throws:
InvalidValue
-
isRecursive
protected boolean isRecursive() -
current_component
Description copied from interface:DynAnyOperationsReturns the DynAny for the component at the current position. It does not advance the current position, so repeated calls to current_component without an intervening call to rewind, next, or seek return the same component. The returned DynAny object reference can be used to get/set the value of the current component. If the current component represents a complex type, the returned reference can be narrowed based on the TypeCode to get the interface corresponding to the to the complex type. Calling current_component on a DynAny that cannot have components, such as a DynEnum or an empty exception, raises TypeMismatch. Calling current_component on a DynAny whose current position is -1 returns a nil reference. The iteration operations, together with current_component, can be used to dynamically compose an any value. After creating a dynamic any, such as a DynStruct, current_component and next can be used to initialize all the components of the value. Once the dynamic value is completely initialized, to_any creates the corresponding any value.- Throws:
TypeMismatch
-
component_count
public int component_count()Description copied from interface:DynAnyOperationsReturns the number of components of a DynAny. For a DynAny without components, it returns zero. The operation only counts the components at the top level. For example, if component_count is invoked on a DynStruct with a single member, the return value is 1, irrespective of the type of the member.- For sequences, the operation returns the current number of elements.
- For structures, exceptions, and value types, the operation returns the number of members.
- For arrays, the operation returns the number of elements.
- For unions, the operation returns 2 if the discriminator indicates that a named member is active, otherwise, it returns 1.
- For DynFixed and DynEnum, the operation returns zero.
-
next
public boolean next()Description copied from interface:DynAnyOperationsAdvances the current position to the next component. The operation returns true while the resulting current position indicates a component, false otherwise. A false return value leaves the current position at -1. Invoking next on a DynAny without components leaves the current position at -1 and returns false. -
seek
public boolean seek(int newIndex) Description copied from interface:DynAnyOperationsSets the current position to index. The current position is indexed 0 to n-1, that is, index zero corresponds to the first component. The operation returns true if the resulting current position indicates a component of the DynAny and false if index indicates a position that does not correspond to a component. Calling seek with a negative index is legal. It sets the current position to -1 to indicate no component and returns false. Passing a non-negative index value for a DynAny that does not have a component at the corresponding position sets the current position to -1 and returns false. -
rewind
public void rewind()Description copied from interface:DynAnyOperationsIs equivalent to seek(0). -
writeAny
-
checkInitComponents
protected boolean checkInitComponents() -
checkInitAny
protected void checkInitAny() -
initializeAnyFromComponents
protected boolean initializeAnyFromComponents() -
assign
Description copied from interface:DynAnyOperationsInitializes the value associated with a DynAny object with the value associated with another DynAny object. The current position of the target DynAny is set to zero for values that have components and to -1 for values that do not have components.- Specified by:
assignin interfaceDynAnyOperations- Throws:
TypeMismatch
-
from_any
Description copied from interface:DynAnyOperationsInitializes the value associated with a DynAny object with the value contained in an any. The current position of the target DynAny is set to zero for values that have components and to -1 for values that do not have components.- Specified by:
from_anyin interfaceDynAnyOperations- Throws:
TypeMismatchInvalidValue
-
to_any
Description copied from interface:DynAnyOperationsCreates an any value from a DynAny object. A copy of the TypeCode associated with the DynAny object is assigned to the resulting any. The value associated with the DynAny object is copied into the any.- Specified by:
to_anyin interfaceDynAnyOperations- Returns:
- a new Any object with the same value and TypeCode
-
equal
Description copied from interface:DynAnyOperationsCompares two DynAny values for equality. Two DynAny values are equal if their TypeCodes are equivalent and, recursively, all component DynAnys have equal values. The current position of the two DynAnys being compared has no effect on the result of equal.- Specified by:
equalin interfaceDynAnyOperations- Returns:
- true of the DynAnys are equal, false otherwise
-
destroy
public void destroy()Description copied from interface:DynAnyOperationsDestroys a DynAny object. This operation frees any resources used to represent the data value associated with a DynAny object. It must be invoked on references obtained from one of the creation operations on the ORB interface or on a reference returned by DynAny.copy() to avoid resource leaks. Invoking destroy on component DynAny objects (for example, on objects returned by the current_component operation) does nothing. Destruction of a DynAny object implies destruction of all DynAny objects obtained from it. That is, references to components of a destroyed DynAny become invalid. Invocations on such references raise OBJECT_NOT_EXIST. It is possible to manipulate a component of a DynAny beyond the life time of the DynAny from which the component was obtained by making a copy of the component with the copy operation before destroying the DynAny from which the component was obtained.- Specified by:
destroyin interfaceDynAnyOperations
-
copy
Description copied from interface:DynAnyOperationsCreates a new DynAny object whose value is a deep copy of the DynAny on which it is invoked. The operation is polymorphic, that is, invoking it on one of the types derived from DynAny, such as DynStruct, creates the derived type but returns its reference as the DynAny base type.- Specified by:
copyin interfaceDynAnyOperations- Returns:
- a deep copy of the DynAny object
-
insert_boolean
Description copied from interface:DynAnyOperationsInserts a boolean value into the DynAny.- Throws:
TypeMismatchInvalidValue
-
insert_octet
Description copied from interface:DynAnyOperationsInserts a byte value into the DynAny. The IDL octet data type is mapped to the Java byte data type.- Throws:
TypeMismatchInvalidValue
-
insert_char
Description copied from interface:DynAnyOperationsInserts a char value into the DynAny.- Throws:
TypeMismatchInvalidValue
-
insert_short
Description copied from interface:DynAnyOperationsInserts a short value into the DynAny.- Throws:
TypeMismatchInvalidValue
-
insert_ushort
Description copied from interface:DynAnyOperationsInserts a short value into the DynAny. The IDL ushort data type is mapped to the Java short data type.- Throws:
TypeMismatchInvalidValue
-
insert_long
Description copied from interface:DynAnyOperationsInserts an integer value into the DynAny. The IDL long data type is mapped to the Java int data type.- Throws:
TypeMismatchInvalidValue
-
insert_ulong
Description copied from interface:DynAnyOperationsInserts an integer value into the DynAny. The IDL ulong data type is mapped to the Java int data type.- Throws:
TypeMismatchInvalidValue
-
insert_float
Description copied from interface:DynAnyOperationsInserts a float value into the DynAny.- Throws:
TypeMismatchInvalidValue
-
insert_double
Description copied from interface:DynAnyOperationsInserts a double value into the DynAny.- Throws:
TypeMismatchInvalidValue
-
insert_string
Description copied from interface:DynAnyOperationsInserts a string value into the DynAny. Both bounded and unbounded strings are inserted using this method.- Throws:
TypeMismatchInvalidValue
-
insert_reference
Description copied from interface:DynAnyOperationsInserts a reference to a CORBA object into the DynAny.- Throws:
TypeMismatchInvalidValue
-
insert_typecode
Description copied from interface:DynAnyOperationsInserts a TypeCode object into the DynAny.- Throws:
TypeMismatchInvalidValue
-
insert_longlong
Description copied from interface:DynAnyOperationsInserts a long value into the DynAny. The IDL long long data type is mapped to the Java long data type.- Throws:
TypeMismatchInvalidValue
-
insert_ulonglong
Description copied from interface:DynAnyOperationsInserts a long value into the DynAny. The IDL unsigned long long data type is mapped to the Java long data type.- Throws:
TypeMismatchInvalidValue
-
insert_wchar
Description copied from interface:DynAnyOperationsInserts a char value into the DynAny. The IDL wchar data type is mapped to the Java char data type.- Throws:
TypeMismatchInvalidValue
-
insert_wstring
Description copied from interface:DynAnyOperationsInserts a string value into the DynAny. Both bounded and unbounded strings are inserted using this method.- Throws:
TypeMismatchInvalidValue
-
insert_any
Description copied from interface:DynAnyOperationsInserts an Any value into the Any represented by this DynAny.- Throws:
TypeMismatchInvalidValue
-
insert_dyn_any
Description copied from interface:DynAnyOperationsInserts the Any value contained in the parameter DynAny into the Any represented by this DynAny.- Throws:
TypeMismatchInvalidValue
-
insert_val
Description copied from interface:DynAnyOperationsInserts a reference to a Serializable object into this DynAny. The IDL ValueBase type is mapped to the Java Serializable type.- Throws:
TypeMismatchInvalidValue
-
get_val
Description copied from interface:DynAnyOperationsExtracts a Serializable object from this DynAny. The IDL ValueBase type is mapped to the Java Serializable type.- Throws:
TypeMismatchInvalidValue
-
get_boolean
Description copied from interface:DynAnyOperationsExtracts the boolean value from this DynAny.- Throws:
TypeMismatchInvalidValue
-
get_octet
Description copied from interface:DynAnyOperationsExtracts the byte value from this DynAny. The IDL octet data type is mapped to the Java byte data type.- Throws:
TypeMismatchInvalidValue
-
get_char
Description copied from interface:DynAnyOperationsExtracts the char value from this DynAny.- Throws:
TypeMismatchInvalidValue
-
get_short
Description copied from interface:DynAnyOperationsExtracts the short value from this DynAny.- Throws:
TypeMismatchInvalidValue
-
get_ushort
Description copied from interface:DynAnyOperationsExtracts the short value from this DynAny. The IDL ushort data type is mapped to the Java short data type.- Throws:
TypeMismatchInvalidValue
-
get_long
Description copied from interface:DynAnyOperationsExtracts the integer value from this DynAny. The IDL long data type is mapped to the Java int data type.- Throws:
TypeMismatchInvalidValue
-
get_ulong
Description copied from interface:DynAnyOperationsExtracts the integer value from this DynAny. The IDL ulong data type is mapped to the Java int data type.- Throws:
TypeMismatchInvalidValue
-
get_float
Description copied from interface:DynAnyOperationsExtracts the float value from this DynAny.- Throws:
TypeMismatchInvalidValue
-
get_double
Description copied from interface:DynAnyOperationsExtracts the double value from this DynAny.- Throws:
TypeMismatchInvalidValue
-
get_string
Description copied from interface:DynAnyOperationsExtracts the string value from this DynAny. Both bounded and unbounded strings are extracted using this method.- Throws:
TypeMismatchInvalidValue
-
get_reference
Description copied from interface:DynAnyOperationsExtracts the reference to a CORBA Object from this DynAny.- Throws:
TypeMismatchInvalidValue
-
get_typecode
Description copied from interface:DynAnyOperationsExtracts the TypeCode object from this DynAny.- Throws:
TypeMismatchInvalidValue
-
get_longlong
Description copied from interface:DynAnyOperationsExtracts the long value from this DynAny. The IDL long long data type is mapped to the Java long data type.- Throws:
TypeMismatchInvalidValue
-
get_ulonglong
Description copied from interface:DynAnyOperationsExtracts the long value from this DynAny. The IDL unsigned long long data type is mapped to the Java long data type.- Throws:
TypeMismatchInvalidValue
-
get_wchar
Description copied from interface:DynAnyOperationsExtracts the long value from this DynAny. The IDL wchar data type is mapped to the Java char data type.- Throws:
TypeMismatchInvalidValue
-
get_wstring
Description copied from interface:DynAnyOperationsExtracts the string value from this DynAny. Both bounded and unbounded strings are extracted using this method.- Throws:
TypeMismatchInvalidValue
-
get_any
Description copied from interface:DynAnyOperationsExtracts an Any value contained in the Any represented by this DynAny.- Throws:
TypeMismatchInvalidValue
-
get_dyn_any
Description copied from interface:DynAnyOperationsExtracts the Any value contained in the Any represented by this DynAny and returns it wrapped into a new DynAny.- Throws:
TypeMismatchInvalidValue
-
factory
-
getAny
-
getAny
-
setStatus
protected void setStatus(byte newStatus) -
type
Description copied from interface:DynAnyOperationsReturns the TypeCode associated with this DynAny object. A DynAny object is created with a TypeCode value assigned to it. This TypeCode value determines the type of the value handled through the DynAny object. Note that the TypeCode associated with a DynAny object is initialized at the time the DynAny is created and cannot be changed during lifetime of the DynAny object.- Specified by:
typein interfaceDynAnyOperations- Returns:
- The TypeCode associated with this DynAny object
-
_ids
-