Java Reflection Method Getter Invoke invokeGetter(Method getter, Object object)

Here you can find the source of invokeGetter(Method getter, Object object)

Description

invoke Getter

License

Apache License

Declaration

private static Object invokeGetter(Method getter, Object object) 

Method Source Code

//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);
        }
    }
}

Related

  1. invokeGetMethod(Object obj, String getterName)
  2. invokeGetter(Object bean, Method getter)
  3. invokeGetter(Object entity, String propertyName)
  4. invokeGetter(Object getterOwner, Method method)
  5. invokeGetter(Object o, String name, boolean forceAccess)