Java tutorial
//package com.java2s; //License from project: Apache License import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; public class Main { private static Object invokeGetter(Method getter, Object object) { try { getter.setAccessible(true); return getter.invoke(object, new Object[0]); } catch (IllegalAccessException e) { throw new IllegalStateException(e); } catch (InvocationTargetException e) { throw new IllegalStateException(e); } } }