Object object = clazz.newInstance();
// Populate the fields with data from the result
Field[] fields = clazz.getFields();
for (Field field : fields) {
GdbMiField fieldAnnotation = field.getAnnotation(GdbMiField.class);
if (fieldAnnotation == null) {
continue;
}
// Find a result with the requested variable name
for (GdbMiResult result : results) {
if (!fieldAnnotation.name().equals(result.variable)) {
continue;
}
// Found a matching field; convert the value
convertField(object, clazz, field, fieldAnnotation, result);