循环向上转型，获取对象的 DeclaredMethod，并强制设置为可访问。
如向上转型到 Object 仍无法找到，返回 null。
只匹配函数名。
用于方法需要被多次调用的情况。先使用本函数先取得 Method，然后调用 Method.invoke(Object obj, Object... args)

@param target
目标对象
@param name
方法名
@return 方法
431446
public static Method getAccessibleMethodByName(final Object target, final String name) {
		for (Class<?> searchType = target.getClass(); searchType != Object.class; searchType = searchType.getSuperclass()) {
			Method[] methods = searchType.getDeclaredMethods();
			for (Method method : methods) {
				if (method.getName().equals(name)) {
					makeAccessible(method);
					return method;
				}
			}
		}
		return null;
	}
410456
public Object invokeMethod(String name, Object args) {
        try {
            return getMetaClass().invokeMethod(this, name, args);
        } catch (MissingMethodException e) {
            // let's apply the method to each item in the collection
            List answer = new ArrayList(size());
            for (Object element : this) {
                Object value = InvokerHelper.invokeMethod(element, name, args);
                answer.add(value);
            }
            return answer;
        }
    }
384335
public function invokeMethod($name, array $args = array(), $object = null)
    {
        return $this->getMethod($name)->invokeArgs($this->getObject($object), $args);
    }
314210
private Object invokeTarget(Object target, Method method, Object[] args) throws Throwable {
        Object returnValue;
        try {
            returnValue = method.invoke(target, args);
        } catch(InvocationTargetException ite) {
            throw ite.getTargetException();
        }
        return returnValue;
    }
835002
private Object invokeImpl(Object thiz, String name, Object... args)
            throws ScriptException, NoSuchMethodException {
        if (name == null) {
            throw new NullPointerException("method name is null");
        }

        try {
            if (thiz != null) {
                return InvokerHelper.invokeMethod(thiz, name, args);
            } else {
                return callGlobal(name, args);
            }
        } catch (MissingMethodException mme) {
            throw new NoSuchMethodException(mme.getMessage());
        } catch (Exception e) {
            throw new ScriptException(e);
        }
    }
727061
@SuppressWarnings("unchecked")
    public static <T> T execMethod(Method method, Object target, Object... params) {
        allowAccess(method);
        try {
            return (T) method.invoke(target, params);
        } catch (Throwable e) {
            throw new ReflectException(e);
        }
    }
1942
public static <T> T getFieldValue(final Object target, final String name) {
		Field field = FieldUtils.getDeclaredField(target.getClass(), name, true);

		if (field == null) {
			throw new IllegalArgumentException("Could not find field [" + name + "] on target [" + target + ']');
		}

		T result = null;
		try {
			result = (T) field.get(target);
		} catch (IllegalAccessException e) {
			throw new ImpossibleException(e);
		}
		return result;
	}
412813
public Object methodMissing(String name, Object args) {
        String str = this.toString();
        return InvokerHelper.invokeMethod(str, name, args);
    }
808040
public static Object invokeTarget(Object target, Method method, Object[] args,
			final String requestName) throws IllegalAccessException, InvocationTargetException {
		boolean systemError = false;
		try {
			SERVICES_COUNTER.bindContextIncludingCpu(requestName);
			return method.invoke(target, args);
		} catch (final InvocationTargetException e) {
			if (e.getCause() instanceof Error) {
				// on catche Error pour avoir les erreurs systèmes
				// mais pas Exception qui sont fonctionnelles en général
				systemError = true;
			}
			throw e;
		} finally {
			// on enregistre la requête dans les statistiques
			SERVICES_COUNTER.addRequestForCurrentContext(systemError);
		}
	}
1087195
@Override public Object invokeMethod(final String name, final Object arguments) {
    if (GantState.dryRun) {
      if (GantState.verbosity > GantState.SILENT) {
        final StringBuilder sb = new StringBuilder();
        int padding = 9 - name.length();
        if (padding < 0) { padding = 0; }
        sb.append("         ".substring(0, padding) + '[' + name + "] ");
        final Object[] args = (Object[]) arguments;
        if (args[0] instanceof Map<?,?>) {
          //////////////////////////////////////////////////////////////////////////////////////////////////////////
          // Eclipse and IntelliJ IDEA warn that (Map) is not a proper cast but using the
          // cast (Map<?,?>) causes a type check error due to the capture algorithm.
          //
          //  TODO : Fix this rather than use a SuppressWarnings.
          //////////////////////////////////////////////////////////////////////////////////////////////////////////
          @SuppressWarnings({ "unchecked", "rawtypes" } ) final Iterator<Map.Entry<?,?>> i =((Map) args[0]).entrySet().iterator();
          while (i.hasNext()) {
            final Map.Entry<?,?> e = i.next();
            sb.append(e.getKey() + " : '" + e.getValue() + '\'');
            if (i.hasNext()) { sb.append(", "); }
          }
          sb.append('\n');
          getProject().log(sb.toString());
          if (args.length == 2) {((Closure<?>) args[1]).call(); }
        }
        else if (args[0] instanceof Closure) { ((Closure<?>) args[0]).call(); }
        else { throw new RuntimeException("Unexpected type of parameter to method " + name); }
      }
      return null;
    }
    return super.invokeMethod(name, arguments);
  }
1349537
public static Object getAttribute(Object target, String name) {
    try {
      return InvokerHelper.getAttribute(target, name);
    } catch (InvokerInvocationException e) {
      ExceptionUtil.sneakyThrow(e.getCause());
      return null; // never reached
    }
  }
792911
public Object invokeMethod(String name, Object args) {
        try {
        return getMetaClass().invokeMethod(this, name, args);
        }
        catch (MissingMethodException e) {
            // lets apply the method to each item in the collection
            List answer = new ArrayList(size());
            for (Iterator iter = iterator(); iter.hasNext(); ) {
                Object element = iter.next();
                Object value = InvokerHelper.invokeMethod(element, name, args);
                answer.add(value);
            }
            return answer;
        }
    }
574221
public Object invokeStaticMethod(Object object, String methodName, Object[] arguments) {
        if (invokeStaticMethodMethod != null) {
            MetaClassHelper.unwrap(arguments);
            return invokeStaticMethodMethod.invoke(object, new Object[]{methodName, arguments});
        }
        return super.invokeStaticMethod(object, methodName, arguments);
    }
1159586
public Object invoke(TargetMetaRequest targetMetaRequest, Method method, Object[] args) throws Throwable {
		targetMetaRequestsHolder.setTargetMetaRequest(targetMetaRequest);
		Debug.logVerbose(
				"[JdonFramework] enter AOP invoker2 for:" + targetMetaRequest.getTargetMetaDef().getClassName() + " method:" + method.getName(),
				module);

		Object result = null;
		MethodInvocation methodInvocation = null;
		try {
			List<MethodInterceptor> chain = advisorChainFactory.create(targetMetaRequest.getTargetMetaDef());
			methodInvocation = new ProxyMethodInvocation(chain, targetMetaRequestsHolder, targetServiceFactory, method, args);
			Debug.logVerbose("[JdonFramework] MethodInvocation will proceed ... ", module);
			result = methodInvocation.proceed();
		} catch (Exception ex) {
			Debug.logError(ex, module);
			throw new Exception(ex);
		} catch (Throwable ex) {
			throw new Throwable(ex);
		} finally {
			targetMetaRequestsHolder.clear();
		}
		return result;

	}
84128
public static Object invoke(String name, Object[] args) throws PageException {
	return invoke(null, name, args);
    }
808191
protected function invokeInaccessibleMethod($object, $name, array $args = [])
    {
        $method = new \ReflectionMethod($object, $name);
        $method->setAccessible(true);
        return $method->invokeArgs(is_object($object) ? $object : null, $args);
    }
294327
public static MethodInvoker getInvokder(Class c, String name)
	{
		//先检测 get，然后 is，然后是general get
//性能慢，但需要证,重要的是，类重加载后，根据字符串知道method，是错误的
//		String key = c.toString().concat("_").concat(name); 
		MethodInvoker invoker = null;
		Map<String,MethodInvoker> map = methodInvokerCache.get(c);
		if(map!=null){
			invoker = map.get(name);
			if (invoker != null)
			{
				return invoker;
			}
		}
		
		//try get
		String methodName = getGetMethod(name);
		Method method = getGetMethod(c, methodName, null);
		if (method != null)
		{
			invoker = new PojoMethodInvoker(method);
			
		}
		
		//try is 
		if(invoker==null){			
			if(name.startsWith("is")){
				methodName = name;
				method = getGetMethod(c, methodName, null);
				if(method!=null){
					invoker = new PojoMethodInvoker(method);
				}
			}else{
				methodName = getIsMethod(name);
				method = getGetMethod(c, methodName, null);
				if(method!=null){
					invoker = new PojoMethodInvoker(method);
				}
			}
	
		}
		
		//bug fix:java bean 规范  cName--> getcName()
		if(invoker==null){
			if(name.length()>1&&(name.charAt(1)>='A'&&name.charAt(1)<='Z')){				
				methodName = "get"+name;
				method = getGetMethod(c, methodName, null);
				if(method!=null){
					invoker = new PojoMethodInvoker(method);
				}else{
					methodName = "is"+name;
					method = getGetMethod(c, methodName, null);
					if(method!=null){
						invoker = new PojoMethodInvoker(method);
					}
				}
				
			}
		}
		
		// general get,string objct allow
		if(invoker==null){
			method = getGetMethod(c, "get", new Class[]
					{ Object.class });
			if (method != null)
			{
				invoker = new GeneralGetMethodInvoker(method, name);
			}else{
				method = getGetMethod(c, "get", new Class[]
						{ String.class });
				if(method!=null){
					invoker = new GeneralGetMethodInvoker(method, name);
				}
			}
			
		}
		
		
		
		
		if (invoker != null)
		{
			if(map==null){
				map = new ConcurrentHashMap<String,MethodInvoker>();
				methodInvokerCache.put(c, map);
			}
			map.put(name, invoker);
			return invoker;
		}
		else
		{
			return null;
		}

	}