use of sun.reflect.MethodAccessor in project sql2o by aaberg.
the class MethodAccessorsGenerator method newGetter.
public Getter newGetter(final Method method) {
final Class type = method.getReturnType();
final MethodAccessor methodAccessor = newMethodAccessor(method);
return new Getter() {
public Object getProperty(Object obj) {
try {
return methodAccessor.invoke(obj, null);
} catch (InvocationTargetException e) {
throw new Sql2oException("error while calling getter method with name " + method.getName() + " on class " + obj.getClass().toString(), e);
}
}
public Class getType() {
return type;
}
};
}
Aggregations