Here you can find the source of invoke(Object owner, String methodName)
static <T> T invoke(Object owner, String methodName)
//package com.java2s; /*// ww w . j ava 2 s . co m * Copyright (c) 2006-2011 Rog?rio Liesenfeld * This file is subject to the terms of the MIT license (see LICENSE.txt). */ import java.lang.reflect.*; public class Main { static <T> T invoke(Object owner, String methodName) { Method m; try { m = owner.getClass().getDeclaredMethod(methodName); } catch (NoSuchMethodException e) { throw new RuntimeException(e); } m.setAccessible(true); try { //noinspection unchecked return (T) m.invoke(owner); } catch (InvocationTargetException e) { throw new RuntimeException(e.getCause()); } catch (IllegalAccessException e) { throw new RuntimeException(e); } } }