Java Code Examples for org.springframework.beans.BeanUtils#findMethod()
The following examples show how to use
org.springframework.beans.BeanUtils#findMethod() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractEasySentinelAspectSupport.java From easy-sentinel with Apache License 2.0 | 5 votes |
/** * 调用处理器来处理 * * @param name 方法名 * @param locationClass 依赖处理类 * @return */ private Method extractBlockHandlerMethod(ProceedingJoinPoint pjp, String name, Class<?> locationClass, BlockException ex) { Object[] originArgs = pjp.getArgs(); Object[] args = new Object[originArgs.length + 1]; args[0] = ex; System.arraycopy(originArgs, 0, args, 1, originArgs.length); return BeanUtils.findMethod(locationClass, name, getParameterTypes(args)); }
Example 2
Source File: AbstractEasySentinelAspectSupport.java From easy-sentinel with Apache License 2.0 | 5 votes |
/** * 调用本实例中的方法 * * @param pjp 切入点 * @param fallbackName 备用方法名 * @return */ private Method extractFallbackMethod(ProceedingJoinPoint pjp, String fallbackName) { Object[] args = pjp.getArgs(); if (StringUtils.isEmpty(fallbackName)) { return null; } else { Class<?> clazz = pjp.getTarget().getClass(); return BeanUtils.findMethod(clazz, fallbackName, getParameterTypes(args)); } }
Example 3
Source File: MyBatisUtils.java From platform with Apache License 2.0 | 5 votes |
/** * 获取方法返回类型 * * @param mappedStatement {@link MappedStatement} * @return Class */ public static Class<?> getReturnType(MappedStatement mappedStatement) { try { String id = mappedStatement.getId(); Class<?> mapperInterface = Class.forName(id.substring(0, id.lastIndexOf("."))); String methodName = id.substring(id.lastIndexOf(".") + 1); Method method = BeanUtils.findMethod(mapperInterface, methodName); return method.getReturnType(); } catch (Exception e) { throw new RuntimeException(e); } }
Example 4
Source File: PropertyTreeTest.java From rice with Educational Community License v2.0 | 4 votes |
@Test public void testGet_jstlGet() throws Exception { setManyMixedKeys(); Class[] getParamTypes = { Object.class }; Object level1 = tree.get("known"); Method m1 = BeanUtils.findMethod(level1.getClass(), "get", getParamTypes); Object level2 = m1.invoke(level1, new Object[] { "complex" }); Method m2 = BeanUtils.findMethod(level2.getClass(), "get", getParamTypes); Object level3 = m2.invoke(level2, new Object[] { "key" }); String value = level3.toString(); assertNotNull(value); assertEquals(KNOWN_COMPLEX_VALUE, value); }