* for an array.
*/
private void computeType(ClassLoader classLoader) throws DeserializerException {
if (!_xmlTypeName.startsWith(TYPENAME_PREFIX)) {
throw new DeserializerException(
"Invalid array type name prefix: " + _xmlTypeName);
}
String compTypeName = null;
try {
int i = TYPENAME_PREFIX.length();
int s = i;
// dimension
while (_xmlTypeName.charAt(i) != '_') {
++i;
}
int dim;
if (s == i) {
dim = 1;
}
else {
dim = Integer.parseInt(_xmlTypeName.substring(s, i));
}
int[] dimensions = new int[dim];
// _of_
s = i;
i = s + "_of_".length();
if (!_xmlTypeName.substring(s, i).equals("_of_")) {
throw new DeserializerException(
"Invalid array type name: _of_ expected: "
+ _xmlTypeName.substring(s, i));
}
// component type name
compTypeName = _xmlTypeName.substring(i);
Class compType;
if (compTypeName.equals("byte")) {
compType = byte.class;
}
else if (compTypeName.equals("char")) {
compType = char.class;
}
else if (compTypeName.equals("double")) {
compType = double.class;
}
else if (compTypeName.equals("float")) {
compType = float.class;
}
else if (compTypeName.equals("int")) {
compType = int.class;
}
else if (compTypeName.equals("long")) {
compType = long.class;
}
else if (compTypeName.equals("short")) {
compType = short.class;
}
else if (compTypeName.equals("boolean")) {
compType = boolean.class;
}
else {
compType =
Class.forName(
ObjectSerializer.fixJavaTypeNameForInnerClass(compTypeName),
true,
classLoader);
}
Object array = Array.newInstance(compType, dimensions);
_type = array.getClass();
}
catch (ClassNotFoundException ex) {
throw new DeserializerException(
"can't get java class for: " + compTypeName + ": " + ex.toString());
}
catch (StringIndexOutOfBoundsException ex) {
throw new DeserializerException(
"Invalid array type name: " + _xmlTypeName);
}
}