Here you can find the source of invokeGetter(Method getter, Object object)
private static Object invokeGetter(Method getter, Object object)
//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 {//from ww w. j a va2 s . com getter.setAccessible(true); return getter.invoke(object, new Object[0]); } catch (IllegalAccessException e) { throw new IllegalStateException(e); } catch (InvocationTargetException e) { throw new IllegalStateException(e); } } }