org.jinterop.dcom.core
Class JIUnion

java.lang.Object
  extended by org.jinterop.dcom.core.JIUnion
All Implemented Interfaces:
java.io.Serializable

public final class JIUnion
extends java.lang.Object
implements java.io.Serializable

This class represents the Union data type. Its usage is dictated by the discriminant which acts as a "switch" to select the correct member to be serialized\deserialzed.
Sample Usage :-
JIUnion forTypeDesc = new JIUnion(Short.class);
JIPointer ptrToTypeDesc = new JIPointer(typeDesc);
JIPointer ptrToArrayDesc = new JIPointer(arrayDesc);
forTypeDesc.addMember(TypeDesc.VT_PTR,ptrToTypeDesc);
forTypeDesc.addMember(TypeDesc.VT_SAFEARRAY,ptrToTypeDesc);
forTypeDesc.addMember(TypeDesc.VT_CARRAY,ptrToArrayDesc);
forTypeDesc.addMember(TypeDesc.VT_USERDEFINED,Integer.class);
The TypeDesc.VT_PTR is an Integer and is used as a Discriminant to select ptrTypeDesc, TypeDesc.VT_CARRAY chooses ptrArrayDesc.

Since:
1.0
See Also:
Serialized Form

Constructor Summary
JIUnion(java.lang.Class discriminantClass)
          Creates the JIUnion object with discriminant type specified.
 
Method Summary
 void addMember(java.lang.Object discriminant, JIStruct member)
          Adds a member to this Union.
 void addMember(java.lang.Object discriminant, java.lang.Object member)
          Adds a member to this Union.
 java.util.Map getMembers()
          Returns the discriminant Vs there members Map.
 void removeMember(java.lang.Object discriminant)
          Removes the entry , identified by it's discriminant from the Parameter list of the union.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JIUnion

public JIUnion(java.lang.Class discriminantClass)
Creates the JIUnion object with discriminant type specified. Used only during deserializing the union. Can only be of the type Integer,Short,Boolean or Character.

Parameters:
discriminantClass -
Method Detail

addMember

public void addMember(java.lang.Object discriminant,
                      java.lang.Object member)
               throws JIException
Adds a member to this Union. The member is distinguished using the discriminant.

Parameters:
discriminant -
member -
Throws:
JIException

addMember

public void addMember(java.lang.Object discriminant,
                      JIStruct member)
               throws JIException
Adds a member to this Union. The member is distinguished using the discriminant.

Parameters:
discriminant -
member -
Throws:
JIException

removeMember

public void removeMember(java.lang.Object discriminant)
Removes the entry , identified by it's discriminant from the Parameter list of the union.

Parameters:
discriminant -

getMembers

public java.util.Map getMembers()
Returns the discriminant Vs there members Map.

Returns: