public FallbackMethod getFallbackMethod(Class<?> type, Method commandMethod) { return getFallbackMethod(type, commandMethod, false); }
builder.executionType(ExecutionType.getExecutionType(batchReturnType)); builder.observable(observable); FallbackMethod fallbackMethod = MethodProvider.getInstance().getFallbackMethod(obj.getClass(), batchCommandMethod); if (fallbackMethod.isPresent()) { fallbackMethod.validateReturnType(batchCommandMethod);
public void testGetFallbackForExtendedCommandV2_extendedParameterFalse() throws NoSuchMethodException { // given Method extFallback = Service.class.getDeclaredMethod("extCommandV2", String.class, Integer.class, Throwable.class); // when Method fallback = MethodProvider.getInstance().getFallbackMethod(Service.class, extFallback, false).getMethod(); // then assertNull(fallback); }
private static MetaHolder.Builder setFallbackMethod(MetaHolder.Builder builder, Class<?> declaringClass, Method commandMethod) { FallbackMethod fallbackMethod = MethodProvider.getInstance().getFallbackMethod(declaringClass, commandMethod); if (fallbackMethod.isPresent()) { fallbackMethod.validateReturnType(commandMethod); builder .fallbackMethod(fallbackMethod.getMethod()) .fallbackExecutionType(ExecutionType.getExecutionType(fallbackMethod.getMethod().getReturnType())); } return builder; }
public void testGetFallbackForExtendedCommandV2() throws NoSuchMethodException { // given Method extFallback = Service.class.getDeclaredMethod("extCommandV2", String.class, Integer.class, Throwable.class); // when Method fallback = MethodProvider.getInstance().getFallbackMethod(Service.class, extFallback, true).getMethod(); // then assertParamsTypes(fallback, String.class, Integer.class); }
@Test public void testGetExtendedFallback() throws NoSuchMethodException { // given Method command = Service.class.getDeclaredMethod("command", String.class, Integer.class); // when Method extFallback = MethodProvider.getInstance().getFallbackMethod(Service.class, command).getMethod(); // then assertParamsTypes(extFallback, String.class, Integer.class, Throwable.class); }
@Test @DataProvider({"true", "false"}) public void testGetFallbackForExtendedCommand(boolean extended) throws NoSuchMethodException { // given Method extFallback = Service.class.getDeclaredMethod("extCommand", String.class, Integer.class, Throwable.class); // when Method fallback = MethodProvider.getInstance().getFallbackMethod(Service.class, extFallback, extended).getMethod(); // then assertParamsTypes(fallback, String.class, Integer.class, Throwable.class); }
private CommandAction createFallbackAction(MetaHolder metaHolder) { FallbackMethod fallbackMethod = MethodProvider.getInstance().getFallbackMethod(metaHolder.getObj().getClass(), metaHolder.getMethod(), metaHolder.isExtendedFallback()); fallbackMethod.validateReturnType(metaHolder.getMethod());
public FallbackMethod getFallbackMethod(Class<?> type, Method commandMethod) { return getFallbackMethod(type, commandMethod, false); }
builder.executionType(ExecutionType.getExecutionType(batchReturnType)); builder.observable(observable); FallbackMethod fallbackMethod = MethodProvider.getInstance().getFallbackMethod(obj.getClass(), batchCommandMethod); if (fallbackMethod.isPresent()) { fallbackMethod.validateReturnType(batchCommandMethod);
private static MetaHolder.Builder setFallbackMethod(MetaHolder.Builder builder, Class<?> declaringClass, Method commandMethod) { FallbackMethod fallbackMethod = MethodProvider.getInstance().getFallbackMethod(declaringClass, commandMethod); if (fallbackMethod.isPresent()) { fallbackMethod.validateReturnType(commandMethod); builder .fallbackMethod(fallbackMethod.getMethod()) .fallbackExecutionType(ExecutionType.getExecutionType(fallbackMethod.getMethod().getReturnType())); } return builder; }
private CommandAction createFallbackAction(MetaHolder metaHolder) { FallbackMethod fallbackMethod = MethodProvider.getInstance().getFallbackMethod(metaHolder.getObj().getClass(), metaHolder.getMethod(), metaHolder.isExtendedFallback()); fallbackMethod.validateReturnType(metaHolder.getMethod());