Here are the examples of the java api org.springframework.util.ReflectionUtils.findMethod() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
349 Examples
19
Source : PrivateHelper.java
with Apache License 2.0
from zhoutaoo
with Apache License 2.0
from zhoutaoo
/**
* 寻找对象有参方法
*
* @param instance 实例对象
* @param methodName 方法名
* @param parameterTypes 方法参数类型
* @return
*/
public Method findMethod(Object instance, String methodName, Clreplaced<?>... parameterTypes) {
return ReflectionUtils.findMethod(instance.getClreplaced(), methodName, parameterTypes);
}
19
Source : PrivateHelper.java
with Apache License 2.0
from zhoutaoo
with Apache License 2.0
from zhoutaoo
/**
* 寻找对象无参方法
*
* @param instance 实例对象
* @param methodName 方法名
* @return
*/
public Method findMethod(Object instance, String methodName) {
return ReflectionUtils.findMethod(instance.getClreplaced(), methodName);
}
19
Source : CachingOperationInvokerAdvisorTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
private OperationMethod getOperationMethod(String methodName, Clreplaced<?>... parameterTypes) {
Method method = ReflectionUtils.findMethod(TestOperations.clreplaced, methodName, parameterTypes);
return new OperationMethod(method, OperationType.READ);
}
19
Source : EndpointDiscovererTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
private Method findTestEndpointMethod(String name, Clreplaced<?>... paramTypes) {
return ReflectionUtils.findMethod(TestEndpoint.clreplaced, name, paramTypes);
}
19
Source : CrudUtils.java
with Apache License 2.0
from Yiuman
with Apache License 2.0
from Yiuman
public static <W extends Widget<?>> W getWidget(CrudRestful<?, ?> restful, String methodName) throws InvocationTargetException, IllegalAccessException {
Method method = ReflectionUtils.findMethod(restful.getClreplaced(), methodName);
return getWidget(restful, method);
}
19
Source : SpringBeanExecutor.java
with Apache License 2.0
from xjjdog
with Apache License 2.0
from xjjdog
@Override
public ExecutorResult chain(Query query, ExecutorContext ctx) throws InvokeException {
SpringBeanQuery q = SpringBeanQuery.clreplaced.cast(query);
String name = q.getName();
Object bean;
Clreplaced type;
if (q.getInjectType() == SpringBeanQuery.InjectType.BYNAME) {
bean = applicationContext.getBean(name);
type = bean.getClreplaced();
} else {
try {
type = Clreplaced.forName(name);
bean = applicationContext.getBean(type);
} catch (Exception ex) {
throw new InvokeException("no clreplaced found :" + name + " " + ex.getMessage(), ex);
}
}
Method method = ReflectionUtils.findMethod(type, q.getMethodName(), Map.clreplaced);
Object invokeResult;
try {
invokeResult = method.invoke(bean, ctx.getParams());
} catch (Exception e) {
throw new InvokeException(e.getMessage(), e);
}
if (null != invokeResult && !(invokeResult instanceof ExecutorResult)) {
throw new InvokeException("method " + name + ":" + method + " should return Type ChainResult");
}
return null == invokeResult ? null : ExecutorResult.clreplaced.cast(invokeResult);
}
19
Source : PathVariableMapMethodArgumentResolverTests.java
with MIT License
from Vip-Augus
with MIT License
from Vip-Augus
@Before
public void setup() throws Exception {
this.resolver = new PathVariableMapMethodArgumentResolver(ReactiveAdapterRegistry.getSharedInstance());
Method method = ReflectionUtils.findMethod(getClreplaced(), "handle", (Clreplaced<?>[]) null);
this.paramMap = new MethodParameter(method, 0);
this.paramNamedMap = new MethodParameter(method, 1);
this.paramMapNoAnnot = new MethodParameter(method, 2);
this.paramMonoMap = new MethodParameter(method, 3);
}
19
Source : DefaultMessageHandlerMethodFactoryTests.java
with MIT License
from Vip-Augus
with MIT License
from Vip-Augus
private Method getListenerMethod(String methodName, Clreplaced<?>... parameterTypes) {
Method method = ReflectionUtils.findMethod(SampleBean.clreplaced, methodName, parameterTypes);
replacedertNotNull("no method found with name " + methodName + " and parameters " + Arrays.toString(parameterTypes));
return method;
}
19
Source : MessagingMessageListenerAdapterTests.java
with MIT License
from Vip-Augus
with MIT License
from Vip-Augus
protected MessagingMessageListenerAdapter getPayloadInstance(final Object payload, String methodName, Clreplaced... parameterTypes) {
Method method = ReflectionUtils.findMethod(SampleBean.clreplaced, methodName, parameterTypes);
MessagingMessageListenerAdapter adapter = new MessagingMessageListenerAdapter() {
@Override
protected Object extractMessage(javax.jms.Message message) {
return payload;
}
};
adapter.setHandlerMethod(factory.createInvocableHandlerMethod(sample, method));
return adapter;
}
19
Source : MessagingMessageListenerAdapterTests.java
with MIT License
from Vip-Augus
with MIT License
from Vip-Augus
protected MessagingMessageListenerAdapter getSimpleInstance(String methodName, Clreplaced... parameterTypes) {
Method m = ReflectionUtils.findMethod(SampleBean.clreplaced, methodName, parameterTypes);
return createInstance(m);
}
19
Source : MethodJmsListenerEndpointTests.java
with MIT License
from Vip-Augus
with MIT License
from Vip-Augus
private Method getListenerMethod(String methodName, Clreplaced<?>... parameterTypes) {
Method method = ReflectionUtils.findMethod(JmsEndpointSampleBean.clreplaced, methodName, parameterTypes);
replacedertNotNull("no method found with name " + methodName + " and parameters " + Arrays.toString(parameterTypes));
return method;
}
19
Source : MethodJmsListenerEndpointTests.java
with MIT License
from Vip-Augus
with MIT License
from Vip-Augus
private Method getTestMethod() {
return ReflectionUtils.findMethod(MethodJmsListenerEndpointTests.clreplaced, this.name.getMethodName());
}
19
Source : JmsListenerContainerFactoryIntegrationTests.java
with MIT License
from Vip-Augus
with MIT License
from Vip-Augus
private MethodJmsListenerEndpoint createDefaultMethodJmsEndpoint(Clreplaced<?> clazz, String methodName, Clreplaced<?>... paramTypes) {
return createMethodJmsEndpoint(this.factory, ReflectionUtils.findMethod(clazz, methodName, paramTypes));
}
19
Source : AnnotationsScannerTests.java
with MIT License
from Vip-Augus
with MIT License
from Vip-Augus
private Method methodFrom(Clreplaced<?> type) {
return ReflectionUtils.findMethod(type, "method");
}
19
Source : AbstractCacheOperationTests.java
with MIT License
from Vip-Augus
with MIT License
from Vip-Augus
protected <A extends Annotation> CacheMethodDetails<A> create(Clreplaced<A> annotationType, Clreplaced<?> targetType, String methodName, Clreplaced<?>... parameterTypes) {
Method method = ReflectionUtils.findMethod(targetType, methodName, parameterTypes);
replacedert.notNull(method, "requested method '" + methodName + "'does not exist");
A cacheAnnotation = method.getAnnotation(annotationType);
return new DefaultCacheMethodDetails<>(method, cacheAnnotation, getCacheName(cacheAnnotation));
}
19
Source : ExpressionEvaluatorTests.java
with MIT License
from Vip-Augus
with MIT License
from Vip-Augus
private Collection<CacheOperation> getOps(String name) {
Method method = ReflectionUtils.findMethod(AnnotatedClreplaced.clreplaced, name, Object.clreplaced, Object.clreplaced);
return this.source.getCacheOperations(method, AnnotatedClreplaced.clreplaced);
}
19
Source : ServiceMethodInfoTests.java
with Apache License 2.0
from viniciusccarvalho
with Apache License 2.0
from viniciusccarvalho
@Test
public void requestStreamAnnotated() throws Exception {
Method m = ReflectionUtils.findMethod(ServiceInfoTest.clreplaced, "requestStreamAnnotated", null);
ServiceMethodInfo serviceMethodInfo = new ServiceMethodInfo(m);
replacedertThat(Flux.clreplaced).isreplacedignableFrom(serviceMethodInfo.getReturnType().resolve());
replacedertThat(Flux.clreplaced).isreplacedignableFrom(serviceMethodInfo.getParameterType().resolve());
}
19
Source : ServiceMethodInfoTests.java
with Apache License 2.0
from viniciusccarvalho
with Apache License 2.0
from viniciusccarvalho
@Test
public void oneWayMethod() throws Exception {
Method m = ReflectionUtils.findMethod(ServiceInfoTest.clreplaced, "oneWay", String.clreplaced);
ServiceMethodInfo serviceMethodInfo = new ServiceMethodInfo(m);
replacedertThat(ExchangeMode.ONE_WAY).isEqualTo(serviceMethodInfo.getMappingInfo().getExchangeMode());
replacedertThat(Void.TYPE).isEqualTo(serviceMethodInfo.getReturnType().resolve());
replacedertThat(String.clreplaced).isreplacedignableFrom(serviceMethodInfo.getParameterType().resolve());
replacedertThat("/foo").isEqualTo(serviceMethodInfo.getMappingInfo().getPath());
replacedertThat("application/json").isEqualTo(serviceMethodInfo.getMappingInfo().getMimeType().toString());
}
19
Source : ServiceMethodInfoTests.java
with Apache License 2.0
from viniciusccarvalho
with Apache License 2.0
from viniciusccarvalho
@Test(expected = IllegalArgumentException.clreplaced)
public void requestOneWrongReturn() throws Exception {
Method m = ReflectionUtils.findMethod(ServiceInfoTest.clreplaced, "requestOneWrongReturn", null);
ServiceMethodInfo serviceMethodInfo = new ServiceMethodInfo(m);
}
19
Source : ServiceMethodInfoTests.java
with Apache License 2.0
from viniciusccarvalho
with Apache License 2.0
from viniciusccarvalho
@Test(expected = IllegalStateException.clreplaced)
public void failNoArgument() throws Exception {
Method m = ReflectionUtils.findMethod(ServiceInfoTest.clreplaced, "failNoArgument", null);
ServiceMethodInfo serviceMethodInfo = new ServiceMethodInfo(m);
}
19
Source : ServiceMethodInfoTests.java
with Apache License 2.0
from viniciusccarvalho
with Apache License 2.0
from viniciusccarvalho
@Test(expected = IllegalStateException.clreplaced)
public void multiplePayloads() throws Exception {
Method m = ReflectionUtils.findMethod(ServiceInfoTest.clreplaced, "multiplePayloadAnnotations", null);
ServiceMethodInfo serviceMethodInfo = new ServiceMethodInfo(m);
}
19
Source : ServiceMethodInfoTests.java
with Apache License 2.0
from viniciusccarvalho
with Apache License 2.0
from viniciusccarvalho
@Test(expected = IllegalArgumentException.clreplaced)
public void requestStreamWrongReturn() throws Exception {
Method m = ReflectionUtils.findMethod(ServiceInfoTest.clreplaced, "requestStreamWrongReturn", null);
ServiceMethodInfo serviceMethodInfo = new ServiceMethodInfo(m);
}
19
Source : ServiceMethodInfoTests.java
with Apache License 2.0
from viniciusccarvalho
with Apache License 2.0
from viniciusccarvalho
@Test
public void requestOneMapping() throws Exception {
Method m = ReflectionUtils.findMethod(ServiceInfoTest.clreplaced, "requestOneMapping", null);
ServiceMethodInfo serviceMethodInfo = new ServiceMethodInfo(m);
replacedertThat(String.clreplaced).isreplacedignableFrom(serviceMethodInfo.getReturnType().resolve());
replacedertThat(Integer.clreplaced).isreplacedignableFrom(serviceMethodInfo.getParameterType().resolve());
}
19
Source : ServiceMethodInfoTests.java
with Apache License 2.0
from viniciusccarvalho
with Apache License 2.0
from viniciusccarvalho
@Test(expected = IllegalArgumentException.clreplaced)
public void requestStreamWrongParameter() throws Exception {
Method m = ReflectionUtils.findMethod(ServiceInfoTest.clreplaced, "requestStreamWrongParameter", null);
ServiceMethodInfo serviceMethodInfo = new ServiceMethodInfo(m);
}
19
Source : ServiceMethodInfoTests.java
with Apache License 2.0
from viniciusccarvalho
with Apache License 2.0
from viniciusccarvalho
@Test
public void requestMany() throws Exception {
Method m = ReflectionUtils.findMethod(ServiceInfoTest.clreplaced, "requestMany", null);
ServiceMethodInfo serviceMethodInfo = new ServiceMethodInfo(m);
replacedertThat(Flux.clreplaced).isreplacedignableFrom(serviceMethodInfo.getReturnType().resolve());
replacedertThat(String.clreplaced).isreplacedignableFrom(serviceMethodInfo.getParameterType().resolve());
}
19
Source : ServiceMethodInfoTests.java
with Apache License 2.0
from viniciusccarvalho
with Apache License 2.0
from viniciusccarvalho
@Test(expected = IllegalStateException.clreplaced)
public void failNotAnnotated() throws Exception {
Method m = ReflectionUtils.findMethod(ServiceInfoTest.clreplaced, "failNotAnnotated", null);
ServiceMethodInfo serviceMethodInfo = new ServiceMethodInfo(m);
}
19
Source : ServiceMethodInfoTests.java
with Apache License 2.0
from viniciusccarvalho
with Apache License 2.0
from viniciusccarvalho
@Test
public void multipleParameters() throws Exception {
Method m = ReflectionUtils.findMethod(ServiceInfoTest.clreplaced, "oneWayMultipleParameters", null);
ServiceMethodInfo serviceMethodInfo = new ServiceMethodInfo(m);
replacedertThat(String.clreplaced).isreplacedignableFrom(serviceMethodInfo.getParameterType().resolve());
}
19
Source : ServiceMethodInfoTests.java
with Apache License 2.0
from viniciusccarvalho
with Apache License 2.0
from viniciusccarvalho
@Test(expected = IllegalArgumentException.clreplaced)
public void requestManyWrongReturn() throws Exception {
Method m = ReflectionUtils.findMethod(ServiceInfoTest.clreplaced, "requestManyWrongReturn", null);
ServiceMethodInfo serviceMethodInfo = new ServiceMethodInfo(m);
}
19
Source : ServiceMethodInfoTests.java
with Apache License 2.0
from viniciusccarvalho
with Apache License 2.0
from viniciusccarvalho
@Test
public void requestStream() throws Exception {
Method m = ReflectionUtils.findMethod(ServiceInfoTest.clreplaced, "requestStream", null);
ServiceMethodInfo serviceMethodInfo = new ServiceMethodInfo(m);
replacedertThat(Flux.clreplaced).isreplacedignableFrom(serviceMethodInfo.getReturnType().resolve());
replacedertThat(Flux.clreplaced).isreplacedignableFrom(serviceMethodInfo.getParameterType().resolve());
}
19
Source : ServiceMethodInfoTests.java
with Apache License 2.0
from viniciusccarvalho
with Apache License 2.0
from viniciusccarvalho
@Test(expected = IllegalStateException.clreplaced)
public void multipleParametersNotAnnotated() throws Exception {
Method m = ReflectionUtils.findMethod(ServiceInfoTest.clreplaced, "multipleParametersNotAnnotated", null);
ServiceMethodInfo serviceMethodInfo = new ServiceMethodInfo(m);
}
19
Source : ThinJarAppWrapper.java
with Apache License 2.0
from spring-projects-experimental
with Apache License 2.0
from spring-projects-experimental
private boolean isRunning() {
if (app == null) {
return false;
}
Method method = ReflectionUtils.findMethod(this.app.getClreplaced(), "isRunning");
return (Boolean) ReflectionUtils.invokeMethod(method, this.app);
}
19
Source : ThinJarAppWrapper.java
with Apache License 2.0
from spring-projects-experimental
with Apache License 2.0
from spring-projects-experimental
private Throwable getError() {
if (app == null) {
return null;
}
Method method = ReflectionUtils.findMethod(this.app.getClreplaced(), "getError");
return (Throwable) ReflectionUtils.invokeMethod(method, this.app);
}
19
Source : FeignClientBuilderTests.java
with Apache License 2.0
from spring-cloud
with Apache License 2.0
from spring-cloud
private static Object getDefaultValueFromFeignClientAnnotation(final String methodName) {
final Method method = ReflectionUtils.findMethod(FeignClient.clreplaced, methodName);
return method.getDefaultValue();
}
19
Source : PathVariableMapMethodArgumentResolverTests.java
with Apache License 2.0
from SourceHot
with Apache License 2.0
from SourceHot
@BeforeEach
public void setup() throws Exception {
this.resolver = new PathVariableMapMethodArgumentResolver(ReactiveAdapterRegistry.getSharedInstance());
Method method = ReflectionUtils.findMethod(getClreplaced(), "handle", (Clreplaced<?>[]) null);
this.paramMap = new MethodParameter(method, 0);
this.paramNamedMap = new MethodParameter(method, 1);
this.paramMapNoAnnot = new MethodParameter(method, 2);
this.paramMonoMap = new MethodParameter(method, 3);
}
19
Source : DefaultMessageHandlerMethodFactoryTests.java
with Apache License 2.0
from SourceHot
with Apache License 2.0
from SourceHot
private Method getListenerMethod(String methodName, Clreplaced<?>... parameterTypes) {
Method method = ReflectionUtils.findMethod(SampleBean.clreplaced, methodName, parameterTypes);
replacedertThat(("no method found with name " + methodName + " and parameters " + Arrays.toString(parameterTypes))).isNotNull();
return method;
}
19
Source : MethodJmsListenerEndpointTests.java
with Apache License 2.0
from SourceHot
with Apache License 2.0
from SourceHot
private Method getTestMethod() {
return ReflectionUtils.findMethod(MethodJmsListenerEndpointTests.clreplaced, this.methodName);
}
19
Source : MethodJmsListenerEndpointTests.java
with Apache License 2.0
from SourceHot
with Apache License 2.0
from SourceHot
private Method getListenerMethod(String methodName, Clreplaced<?>... parameterTypes) {
Method method = ReflectionUtils.findMethod(JmsEndpointSampleBean.clreplaced, methodName, parameterTypes);
replacedertThat(("no method found with name " + methodName + " and parameters " + Arrays.toString(parameterTypes))).isNotNull();
return method;
}
19
Source : AnnotationUtilsExample.java
with Apache License 2.0
from penggle
with Apache License 2.0
from penggle
/**
* 获取指定类型上的多个注解(此方法仅获取当前类型的注解,不包括其父类上的注解,如果需要请使用findAnnotation(...)方法)
*/
public static void getAnnotations() {
Annotation[] annotations = null;
annotations = AnnotationUtils.getAnnotations(UserApiService.clreplaced);
for (Annotation anno : annotations) {
System.out.println(anno);
}
System.out.println("-------------------------------------");
Method method = ReflectionUtils.findMethod(UserApiService.clreplaced, "createUser", new Clreplaced<?>[] { Map.clreplaced });
annotations = AnnotationUtils.getAnnotations(method);
for (Annotation anno : annotations) {
System.out.println(anno);
}
}
19
Source : RepositoryQueryTest.java
with Apache License 2.0
from neo4j
with Apache License 2.0
from neo4j
static Method queryMethod(String name, Clreplaced<?>... parameters) {
return ReflectionUtils.findMethod(TestRepository.clreplaced, name, parameters);
}
19
Source : DefaultAnnotationAttributeExtractor.java
with MIT License
from mindcarver
with MIT License
from mindcarver
@Override
@Nullable
protected Object getRawAttributeValue(String attributeName) {
Method attributeMethod = ReflectionUtils.findMethod(getAnnotationType(), attributeName);
return (attributeMethod != null ? getRawAttributeValue(attributeMethod) : null);
}
19
Source : TargetFilterDemo.java
with Apache License 2.0
from mercyblitz
with Apache License 2.0
from mercyblitz
public static void main(String[] args) throws ClreplacedNotFoundException {
String targetClreplacedName = "org.geekbang.thinking.in.spring.aop.overview.EchoService";
// 获取当前线程 ClreplacedLoader
ClreplacedLoader clreplacedLoader = Thread.currentThread().getContextClreplacedLoader();
// 获取目标类
Clreplaced<?> targetClreplaced = clreplacedLoader.loadClreplaced(targetClreplacedName);
// 方法定义:String echo(String message);
// Spring 反射工具类
Method targetMethod = ReflectionUtils.findMethod(targetClreplaced, "echo", String.clreplaced);
System.out.println(targetMethod);
// 查找方法 throws 类型为 NullPointerException
ReflectionUtils.doWithMethods(targetClreplaced, new ReflectionUtils.MethodCallback() {
@Override
public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
System.out.println("仅抛出 NullPointerException 方法为:" + method);
}
}, new ReflectionUtils.MethodFilter() {
@Override
public boolean matches(Method method) {
Clreplaced[] parameterTypes = method.getParameterTypes();
Clreplaced[] exceptionTypes = method.getExceptionTypes();
return parameterTypes.length == 1 && String.clreplaced.equals(parameterTypes[0]) && exceptionTypes.length == 1 && NullPointerException.clreplaced.equals(exceptionTypes[0]);
}
});
}
19
Source : DefaultAnnotationAttributeExtractor.java
with Apache License 2.0
from langtianya
with Apache License 2.0
from langtianya
@Override
protected Object getRawAttributeValue(String attributeName) {
Method attributeMethod = ReflectionUtils.findMethod(getAnnotationType(), attributeName);
return getRawAttributeValue(attributeMethod);
}
19
Source : AbstractCacheOperationTests.java
with Apache License 2.0
from langtianya
with Apache License 2.0
from langtianya
protected <A extends Annotation> CacheMethodDetails<A> create(Clreplaced<A> annotationType, Clreplaced<?> targetType, String methodName, Clreplaced<?>... parameterTypes) {
Method method = ReflectionUtils.findMethod(targetType, methodName, parameterTypes);
replacedert.notNull(method, "requested method '" + methodName + "'does not exist");
A cacheAnnotation = method.getAnnotation(annotationType);
return new DefaultCacheMethodDetails<A>(method, cacheAnnotation, getCacheName(cacheAnnotation));
}
19
Source : ExpressionEvaluatorTests.java
with Apache License 2.0
from langtianya
with Apache License 2.0
from langtianya
private Collection<CacheOperation> getOps(String name) {
Method method = ReflectionUtils.findMethod(AnnotatedClreplaced.clreplaced, name, Object.clreplaced, Object.clreplaced);
return source.getCacheOperations(method, AnnotatedClreplaced.clreplaced);
}
19
Source : AnnotationCacheOperationSourceTests.java
with Apache License 2.0
from langtianya
with Apache License 2.0
from langtianya
private Collection<CacheOperation> getOps(Clreplaced<?> target, String name) {
Method method = ReflectionUtils.findMethod(target, name);
return source.getCacheOperations(method, target);
}
19
Source : LocalBundleContextAdviceTest.java
with Apache License 2.0
from eclipse
with Apache License 2.0
from eclipse
protected void setUp() throws Exception {
Method m = ReflectionUtils.findMethod(Object.clreplaced, "hashCode");
context = new MockBundleContext();
interceptor = new LocalBundleContextAdvice(context);
invocation = new MockMethodInvocation(m) {
public Object proceed() throws Throwable {
replacedertSame("bundle context not set", context, LocalBundleContext.getInvokerBundleContext());
return null;
}
};
}
19
Source : RpcOptionBuilder.java
with Apache License 2.0
from bootsrc
with Apache License 2.0
from bootsrc
public static Method obtainMethod(RpcOption rpcOption) {
Clreplaced<?>[] parameterTypes = rpcOption.getParameterTypes();
Clreplaced<?> interfaceClreplaced = rpcOption.getInterfaceClreplaced();
String methodName = rpcOption.getMethodName();
if (Objects.isNull(rpcOption.getParameterTypes())) {
return ReflectionUtils.findMethod(interfaceClreplaced, methodName);
}
return ReflectionUtils.findMethod(interfaceClreplaced, methodName, parameterTypes);
}
19
Source : ResourceInspector.java
with GNU Lesser General Public License v3.0
from Alfresco
with GNU Lesser General Public License v3.0
from Alfresco
/**
* Returns the method for the interface
* @return null or a Method
*/
public static Method findMethod(Clreplaced<? extends ResourceAction> resourceInterfaceWithOneMethod, Clreplaced<?> resource) {
Method[] resourceMethods = resourceInterfaceWithOneMethod.getMethods();
if (resourceMethods == null || resourceMethods.length != 1) {
// All the interfaces should have just one method.
throw new IllegalArgumentException(resourceInterfaceWithOneMethod + " should be an interface with just one method.");
}
Method method = ReflectionUtils.findMethod(resource, resourceMethods[0].getName(), null);
return method;
}
19
Source : PicocliConfiguration.java
with MIT License
from Alan-Gomes
with MIT License
from Alan-Gomes
private List<String> getMainCommands(Collection<String> candidates, ApplicationContext context) {
List<String> mainCommands = new ArrayList<>();
for (String candidate : candidates) {
Clreplaced<?> clazz = getType(context, candidate);
Method method = ReflectionUtils.findMethod(CommandLine.Command.clreplaced, "name");
if (clazz.isAnnotationPresent(CommandLine.Command.clreplaced) && method != null && clazz.getAnnotation(CommandLine.Command.clreplaced).name().equals(method.getDefaultValue())) {
mainCommands.add(candidate);
}
}
return mainCommands;
}
18
Source : SpyBeanWithAopProxyTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
private boolean matchesAnyBoolean() {
if (isTestingMockito1()) {
Method method = ReflectionUtils.findMethod(ClreplacedUtils.resolveClreplacedName("org.mockito.Matchers", null), "anyBoolean");
return (boolean) ReflectionUtils.invokeMethod(method, null);
}
return ArgumentMatchers.anyBoolean();
}
See More Examples