Instantiate a new class with right constructor
try {
// store received value
values.add(value);
// got right parameter length
if (constructor.getParameterTypes().length == values.size()) {
// type of parameters
Class[] classes = constructor.getParameterTypes();
// args array
Object[] args = new Object[constructor.getParameterTypes().length];
// Get arg for the type of the class
for (int c = 0; c < classes.length; c++) {
boolean found = false;
int i = 0;
while (!found && i < values.size()) {
// got right class arg
if (values.get(i).getClass().getName().toLowerCase().indexOf(classes[c].getName().toLowerCase()) != -1) {
found = true;
args[c] = values.get(i);
}
i++;
}
// no suitable object for class required
if (!found) {
throw new SAXException(Messages.getMessage("cannotFindObjectForClass00", classes[c].toString()));
}
}
// then build object
Object o = constructor.newInstance(args);
deSerializer.setValue(o);
}
} catch (Exception e) {
throw new SAXException(e);
}