}
private Object getAndCheckType(String fieldName, Class clazz) throws InvalidFieldException {
Object o = getObject(fieldName);
if (o != null && !clazz.isInstance(o)) {
throw new InvalidFieldException(
"type mismatch expected:" + clazz.getName() + " actual: " + o.getClass().getName());
}
return o;
}