@Test public void testReactorTypes() throws Throwable { TimeLimiter timeLimiter = TimeLimiter.ofDefaults("test"); when(proceedingJoinPoint.proceed()).thenReturn(Mono.just("Test")); assertThat(reactorTimeLimiterAspectExt.handle(proceedingJoinPoint, timeLimiter, "testMethod")).isNotNull(); when(proceedingJoinPoint.proceed()).thenReturn(Flux.just("Test")); assertThat(reactorTimeLimiterAspectExt.handle(proceedingJoinPoint, timeLimiter, "testMethod")).isNotNull(); }
@Override public Object handle(ProceedingJoinPoint proceedingJoinPoint, TimeLimiter timeLimiter, String methodName) throws Throwable { Object returnValue = proceedingJoinPoint.proceed(); if (Flux.class.isAssignableFrom(returnValue.getClass())) { Flux<?> fluxReturnValue = (Flux<?>) returnValue; return fluxReturnValue.transformDeferred(TimeLimiterOperator.of(timeLimiter)); } else if (Mono.class.isAssignableFrom(returnValue.getClass())) { Mono<?> monoReturnValue = (Mono<?>) returnValue; return monoReturnValue.transformDeferred(TimeLimiterOperator.of(timeLimiter)); } else { throw new IllegalReturnTypeException(returnValue.getClass(), methodName, "Reactor expects Mono/Flux."); } }
ReactorTimeLimiterAspectExt implements TimeLimiterAspectExt { @Override public Object handle(ProceedingJoinPoint proceedingJoinPoint, TimeLimiter timeLimiter, String methodName) throws Throwable { Object returnValue = proceedingJoinPoint.proceed(); if (Flux.class.isAssignableFrom(returnValue.getClass())) { Flux<?> fluxReturnValue = (Flux<?>) returnValue; return fluxReturnValue.transformDeferred(TimeLimiterOperator.of(timeLimiter)); } else if (Mono.class.isAssignableFrom(returnValue.getClass())) { Mono<?> monoReturnValue = (Mono<?>) returnValue; return monoReturnValue.transformDeferred(TimeLimiterOperator.of(timeLimiter)); } else { throw new IllegalReturnTypeException(returnValue.getClass(), methodName, "Reactor expects Mono/Flux."); } } }
ReactorTimeLimiterAspectExt implements TimeLimiterAspectExt { @Override public Object handle(ProceedingJoinPoint proceedingJoinPoint, TimeLimiter timeLimiter, String methodName) throws Throwable { Object returnValue = proceedingJoinPoint.proceed(); if (Flux.class.isAssignableFrom(returnValue.getClass())) { Flux<?> fluxReturnValue = (Flux<?>) returnValue; return fluxReturnValue.transformDeferred(TimeLimiterOperator.of(timeLimiter)); } else if (Mono.class.isAssignableFrom(returnValue.getClass())) { Mono<?> monoReturnValue = (Mono<?>) returnValue; return monoReturnValue.transformDeferred(TimeLimiterOperator.of(timeLimiter)); } else { throw new IllegalReturnTypeException(returnValue.getClass(), methodName, "Reactor expects Mono/Flux."); } }  }
ReactorTimeLimiterAspectExt implements TimeLimiterAspectExt { @Override public Object handle(ProceedingJoinPoint proceedingJoinPoint, TimeLimiter timeLimiter, String methodName) throws Throwable { Object returnValue = proceedingJoinPoint.proceed(); if (Flux.class.isAssignableFrom(returnValue.getClass())) { Flux<?> fluxReturnValue = (Flux<?>) returnValue; return fluxReturnValue.transformDeferred(TimeLimiterOperator.of(timeLimiter)); } else if (Mono.class.isAssignableFrom(returnValue.getClass())) { Mono<?> monoReturnValue = (Mono<?>) returnValue; return monoReturnValue.transformDeferred(TimeLimiterOperator.of(timeLimiter)); } else { throw new IllegalReturnTypeException(returnValue.getClass(), methodName, "Reactor expects Mono/Flux."); } }  @Override boolean canHandleReturnType(Class<?> returnType); @Override Object handle(ProceedingJoinPoint proceedingJoinPoint,
        TimeLimiter timeLimiter, String methodName); }
ReactorTimeLimiterAspectExt implements TimeLimiterAspectExt { @Override public Object handle(ProceedingJoinPoint proceedingJoinPoint, TimeLimiter timeLimiter, String methodName) throws Throwable { Object returnValue = proceedingJoinPoint.proceed(); if (Flux.class.isAssignableFrom(returnValue.getClass())) { Flux<?> fluxReturnValue = (Flux<?>) returnValue; return fluxReturnValue.transformDeferred(TimeLimiterOperator.of(timeLimiter)); } else if (Mono.class.isAssignableFrom(returnValue.getClass())) { Mono<?> monoReturnValue = (Mono<?>) returnValue; return monoReturnValue.transformDeferred(TimeLimiterOperator.of(timeLimiter)); } else { throw new IllegalReturnTypeException(returnValue.getClass(), methodName, "Reactor expects Mono/Flux."); } }  @Override boolean canHandleReturnType(Class<?> returnType); @Override Object handle(ProceedingJoinPoint proceedingJoinPoint,
        TimeLimiter timeLimiter, String methodName);  }