|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbiz.c24.io.api.data.DataType
biz.c24.io.api.data.SimpleDataType
biz.c24.io.api.data.UnionDataType
public class UnionDataType
A simple data type representing a union of other simple data types.
For example, this type may be used to represent an integer or a string.
Note, the order in which the member types are added is important. In the above example, if the string was the first member type to be added then all data would be interpreted as strings. This is because the string type is wider than the integer type. In other words narrower member types must be added first.
Warning: Serialized objects of this class or of a deployed class which is derived from it may not be compatible with future releases of C24 Integreation Objects. The current serialization support is appropriate for short term storage or RMI between applications running the same version of C24 Integreation Objects.
Field Summary |
---|
Fields inherited from class biz.c24.io.api.data.DataType |
---|
duringParsing, hasEnumerations, hasPatternMatching, qualifierValidation |
Constructor Summary | |
---|---|
UnionDataType()
Constructs a new instance. |
Method Summary | |
---|---|
void |
addMemberType(SimpleDataType memberType)
Adds a member type. |
String |
formatObject(Object obj,
boolean external)
Formats the supplied obj into a string. |
int |
getMaxSize()
Returns the maximum allowable size out of all the member types. |
SimpleDataType |
getMemberType(int index)
Return the member type at index . |
int |
getMemberTypeCount()
Returns the number of member types that have been added. |
int |
getMinSize()
Returns the minimum allowable size out of all the member types. |
Class |
getValidObjectClass()
Returns the class of valid objects of this type. |
boolean |
isValidObjectClass(Class c)
Returns whether c is the class of a valid object of this type. |
Object |
parseObject(String str,
boolean external)
Parses str into an object derived from on of the member types. |
void |
removeMemberType(int index)
Removes a member type. |
Methods inherited from class biz.c24.io.api.data.SimpleDataType |
---|
formatObject, formatObjectExternal, getInstance, getMaxExclusive, getMaxInclusive, getMinExclusive, getMinInclusive, isComplex, isSimple, isSizeFixed, parseObject, parseObjectExternal, setMaxExclusive, setMaxInclusive, setMinExclusive, setMinInclusive, validateProperties |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public UnionDataType()
Method Detail |
---|
public int getMemberTypeCount()
public SimpleDataType getMemberType(int index)
index
.
index
- The index of the member type to be retrieved.
index
.
IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= getNamespaceCount()).public void addMemberType(SimpleDataType memberType)
memberType
- The new value.
NullPointerException
- if memberType is null.public void removeMemberType(int index)
index
- The index of the member type to be removed.
IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= getMemberTypeCount()).public Class getValidObjectClass()
DataType
getValidObjectClass
in class SimpleDataType
public boolean isValidObjectClass(Class c)
DataType
c
is the class of a valid object of this type.
isValidObjectClass
in class DataType
c
- The class.
public int getMinSize()
getMinSize
in class SimpleDataType
public int getMaxSize()
getMaxSize
in class SimpleDataType
-1
if the size is unbounded.public Object parseObject(String str, boolean external) throws ParserException
str
into an object derived from on of the member types.
The member types are examined in order (starting at index 0) until one is found which is capable of parsing str
.
parseObject
in class SimpleDataType
str
- The string to be parsed.external
- Whether the overrideable parse method may be used.
ParserException
- If the parsing failed.public String formatObject(Object obj, boolean external)
obj
into a string.
formatObject
in class SimpleDataType
obj
- The object to be formatted.external
- Whether the overrideable format method may be used.
IllegalArgumentException
- if the class of obj
is not recognised by any of the member types.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |