}
else if (IntegerData.class.equals(subjectType)) {
subject.setValue(new IntegerData(element.getIntegerValue()));
}
else if (IntegerNullable.class.equals(subjectType)) {
subject.setValue(new IntegerNullable(element.getIntegerValue()));
}
else if (IntegerData.class.isAssignableFrom(subjectType)) {
try {
IntegerData anIntData = (IntegerData)subjectType.newInstance();
anIntData.setValue(element.getIntegerValue());
subject.setValue(anIntData);
}
catch (Exception e) {
// No default constructor
_log.debug("Could not instantiate class " + subjectType.getName(), e);
}
}
else if (TextData.class.equals(subjectType)) {
// TF:27/8/07:We need to clone the return value, otherwise we'll be returning the actual textdata mapped to the listelement
// and any changes on this list element will erroneously affect the underlying list
subject.setValue(CloneHelper.clone(element.getTextValue(), false));
}
else if (TextNullable.class.equals(subjectType)) {
subject.setValue(new TextNullable(element.getTextValue()));
}
else if (TextData.class.isAssignableFrom(subjectType)) {
try {
TextData aTextData = (TextData)subjectType.newInstance();
aTextData.setValue(element.getTextValue());
subject.setValue(aTextData);
}
catch (Exception e) {
// No default constructor
_log.debug("Could not instantiate class " + subjectType.getName(), e);
}
}
else if (String.class.equals(subjectType)) {
subject.setValue(element.toString());
}
else {
// CraigM:11/12/2008 - We can always set the object value as a last resort
subject.setValue(element.getObjectValue());
}
}
// Handle nulls - Can happen when mapped to a IntegerNullable radio list. CraigM 11/10/2007
else if (newValue == null) {
if (IntegerNullable.class.equals(subjectType)) {
subject.setValue(new IntegerNullable((Integer)null));
}
else if (TextNullable.class.equals(subjectType)) {
subject.setValue(new TextNullable((String)null));
}
}