if (Integer.class.equals(elementClass)) {
return new Integer(element.getIntegerValue());
}
else if (IntegerData.class.isAssignableFrom(elementClass)) {
try {
IntegerData newValue = (IntegerData)elementClass.newInstance();
newValue.setValue(element.getIntegerValue());
return newValue;
}
catch (Exception e) {
// Shouldn't get here, let's keep the compiler happy
return new IntegerData(element.getIntegerValue());
}
}
else if (TextData.class.isAssignableFrom(elementClass)) {
try {
TextData newValue = (TextData)elementClass.newInstance();
newValue.setValue(element.getTextValue());
return newValue;
}
catch (Exception e) {
// Shouldn't get here, let's keep the compiler happy
return element == null ? null : element.getTextValue();