ArrayList<?> arrayList = (ArrayList<?>) javaObject;
Iterator<?> arrayListIt = arrayList.iterator();
int index = 0;
while (arrayListIt.hasNext()) {
Object javaObjectInArray = arrayListIt.next();
DebugVariable fieldVar = new DebugVariable("[" + index + "]",
javaObjectInArray.getClass().toString(), javaObjectInArray.toString());
fieldVar = dumpJavaObject(javaObjectInArray, fieldVar);
debugVar.addField(fieldVar);
index++;
}
}
Field[] fields = javaObject.getClass().getFields();
for (int fIndex = 0; fIndex < fields.length; fIndex++) {
Field field = fields[fIndex];
String fieldName = field.getName();
try {
Object fieldObject = field.get(javaObject);
String fieldValue = fieldObject.toString();
DebugVariable fieldVar = new DebugVariable(fieldName,
field.getClass().toString(), fieldValue.toString());
fieldVar = dumpJavaObject(fieldValue, fieldVar);
debugVar.addField(fieldVar);
} catch (IllegalArgumentException e) {
debugVar.addField(new DebugVariable(fieldName,
field.getClass().toString(), "Illegal argument"));
} catch (IllegalAccessException e) {
debugVar.addField(new DebugVariable(fieldName,
field.getClass().toString(), "Illegal Access Exception"));
} catch (NullPointerException e) {
debugVar.addField(new DebugVariable(fieldName,
field.getClass().toString(), "Null Pointer Exception"));
}
}
Method[] methods = javaObject.getClass().getMethods();
for (int methodIndex = 0; methodIndex < methods.length; methodIndex++) {
Method method = methods[methodIndex];
if ((method.getName().startsWith("get")) &&
(!(method.getName().equals("getClass"))) &&
(!(method.getName().equals("getAccessorKeys")))) {
try {
Object returnValue = method.invoke(javaObject, new Object[]{});
DebugVariable fieldVar = new DebugVariable(method.getName(),
javaObject.getClass().toString(), returnValue.toString());
fieldVar = dumpJavaObject(returnValue, fieldVar);
debugVar.addField(fieldVar);
} catch (Exception e) {
}