public interface MUnion extends MData
MUnion
is a special kind of object in which only
one of the declared members can hold a value.
Like classes, unions are containers of data items, but the contents of a union are alternatives. Only one alternative is actually present in the union instance.
Unions have a name and have associated unionMember elements. Each unionMember in turn, has a name and a type. Union and union member objects may have application-defined extendedProperties elements.
You create an MUnion
calling the MDataFactory.newUnion(String)
method.
Modifier and Type | Method and Description |
---|---|
MUnionMemberDescription |
getMember()
Return the currently "active" member in this
MUnion . |
java.lang.Object |
getValue()
Return the value of the union.
|
java.lang.Object |
getValue(java.lang.Object defaultVal)
Return the value of the union or the default value if
any error is encountered.
|
void |
setValue(java.lang.String memberName,
java.lang.Object value)
Make the named union member hold the specified union value.
|
java.lang.String |
toXML()
Returns XML representation of this MUnion
|
clone, get, getCategory, getClassDescription, getTrackingInfo, hashCode, serialize, serialize, set, setTrackingInfo
MUnionMemberDescription getMember()
MUnion
.void setValue(java.lang.String memberName, java.lang.Object value) throws MException
MException
- if the named member is not defined for this union.MException
- if the given value is not assignable to the member
(because of type mismatch).java.lang.Object getValue() throws MException
MException
- if the current value could not be retrieved.java.lang.Object getValue(java.lang.Object defaultVal)
java.lang.String toXML() throws MException
MException