|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jinterop.dcom.core.JIUnion
public final class JIUnion
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);
The TypeDesc.VT_PTR is an
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); Integer
and is used as a discriminant to select ptrTypeDesc, TypeDesc.VT_CARRAY
chooses ptrArrayDesc.
Constructor Summary | |
---|---|
JIUnion(java.lang.Class discriminantClass)
Creates an 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 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JIUnion(java.lang.Class discriminantClass)
Integer
,Short
,Boolean
or Character
.
discriminantClass
-
java.lang.IllegalArgumentException
- if the discriminantClass
is not of the type as specified
above.Method Detail |
---|
public void addMember(java.lang.Object discriminant, java.lang.Object member) throws JIException
member
is distinguished using the discriminant
.
discriminant
- member
-
JIException
java.lang.IllegalArgumentException
- if any parameter is null
public void addMember(java.lang.Object discriminant, JIStruct member) throws JIException
member
is distinguished using the discriminant
.
discriminant
- member
-
JIException
java.lang.IllegalArgumentException
- if discriminant
is null
public void removeMember(java.lang.Object discriminant)
discriminant
from the parameter list of the union.
discriminant
- public java.util.Map getMembers()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |