private String[] fieldNames;
private Class[] fieldTypes;
public int getIndex (String fieldName) {
for (int i = 0, n = fieldNames.length; i < n; i++)
if (fieldNames[i].equals(fieldName)) return i;
<BUG>throw new IllegalArgumentException("Unable to find public field: " + fieldName);
</BUG>
}
public void set (Object instance, String fieldName, Object value) {
set(instance, getIndex(fieldName), value);

private String[] fieldNames;
private Class[] fieldTypes;
public int getIndex (String fieldName) {
for (int i = 0, n = fieldNames.length; i < n; i++)
if (fieldNames[i].equals(fieldName)) return i;
throw new IllegalArgumentException("Unable to find non-private field: " + fieldName);
}
public void set (Object instance, String fieldName, Object value) {
set(instance, getIndex(fieldName), value);
