break; // found the property field, so break the while loop.
} catch (NoSuchFieldException nsfe) {
// property field is not found at current level of class, so continue to super class.
clz = clz.getSuperclass();
if (clz == Object.class) {
throw new SqlException(new LogWriter(logWriter, traceLevel), "bug check: corresponding property field does not exist");
}
continue;
}
}
if (!Modifier.isTransient(propertyField.getModifiers())) {
// if the property is not transient:
// set the property.
address = ref.get(propertyKey);
if (address != null) {
propertyField.setAccessible(true);
String type = propertyField.getType().toString();
if (type.equals("boolean")) {
boolean value = ((String) address.getContent()).equalsIgnoreCase("true");
propertyField.setBoolean(this, value);
} else if (type.equals("byte")) {
byte value = Byte.parseByte((String) address.getContent());
propertyField.setByte(this, value);
} else if (type.equals("short")) {
short value = Short.parseShort((String) address.getContent());
propertyField.setShort(this, value);
} else if (type.equals("int")) {
int value = Integer.parseInt((String) address.getContent());
propertyField.setInt(this, value);
} else if (type.equals("long")) {
long value = Long.parseLong((String) address.getContent());
propertyField.setLong(this, value);
} else if (type.equals("float")) {
float value = Float.parseFloat((String) address.getContent());
propertyField.setFloat(this, value);
} else if (type.equals("double")) {
double value = Double.parseDouble((String) address.getContent());
propertyField.setDouble(this, value);
} else if (type.equals("char")) {
char value = ((String) address.getContent()).charAt(0);
propertyField.setChar(this, value);
} else {
propertyField.set(this, address.getContent());
}
}
}
} catch (IllegalAccessException e) {
throw new SqlException(new LogWriter(this.logWriter, this.traceLevel), "bug check: property cannot be accessed");
}
}
}
}