if (isPrivate) {
// get the value using the generic Object get(Object) method and unbox the value
mg.loadThis();
mg.loadArg(0);
mg.invokeVirtual(Type.getObjectType(className), getMethod(Object.class, "get", Object.class));
mg.unbox(Type.getType(field.getType()));
} else {
// Simply access the field.
mg.loadArg(0);
mg.checkCast(Type.getType(field.getDeclaringClass()));
mg.getField(Type.getType(field.getDeclaringClass()), field.getName(), Type.getType(field.getType()));