Allow null return type for interceptors
This commit is contained in:
parent
690af1c7ff
commit
17f03ac843
|
@ -26,7 +26,6 @@ import static org.junit.Assert.*;
|
|||
@ContextConfiguration(classes = {InterceptorRegistryTest.InterceptorRegistryTestCtxConfig.class})
|
||||
public class InterceptorRegistryTest {
|
||||
|
||||
private static boolean ourNext_beforeRestHookDelivery_Return2;
|
||||
private static boolean ourNext_beforeRestHookDelivery_Return1;
|
||||
private static List<String> ourInvocations = new ArrayList<>();
|
||||
private static CanonicalSubscription ourLastCanonicalSubscription;
|
||||
|
@ -88,7 +87,6 @@ public class InterceptorRegistryTest {
|
|||
@Before
|
||||
public void before() {
|
||||
ourNext_beforeRestHookDelivery_Return1 = true;
|
||||
ourNext_beforeRestHookDelivery_Return2 = true;
|
||||
ourLastCanonicalSubscription = null;
|
||||
ourLastResourceDeliveryMessage0 = null;
|
||||
ourLastResourceDeliveryMessage1 = null;
|
||||
|
@ -140,11 +138,10 @@ public class InterceptorRegistryTest {
|
|||
@Order(200)
|
||||
public static class MyTestInterceptorTwo {
|
||||
@Hook(Pointcut.SUBSCRIPTION_BEFORE_REST_HOOK_DELIVERY)
|
||||
public boolean beforeRestHookDelivery(ResourceDeliveryMessage theResourceDeliveryMessage0, ResourceDeliveryMessage theResourceDeliveryMessage1) {
|
||||
public void beforeRestHookDelivery(ResourceDeliveryMessage theResourceDeliveryMessage0, ResourceDeliveryMessage theResourceDeliveryMessage1) {
|
||||
ourLastResourceDeliveryMessage0 = theResourceDeliveryMessage0;
|
||||
ourLastResourceDeliveryMessage1 = theResourceDeliveryMessage1;
|
||||
ourInvocations.add("MyTestInterceptorTwo.beforeRestHookDelivery");
|
||||
return ourNext_beforeRestHookDelivery_Return2;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -254,10 +254,10 @@ public class InterceptorRegistry implements IInterceptorRegistry, ApplicationCon
|
|||
myMethod = theHookMethod;
|
||||
|
||||
Class<?> returnType = theHookMethod.getReturnType();
|
||||
if (returnType.equals(boolean.class) || returnType.equals(Boolean.class)) {
|
||||
if (returnType.equals(boolean.class)) {
|
||||
myReturnsBoolean = true;
|
||||
} else {
|
||||
Validate.isTrue(Void.class.equals(returnType), "Method does not return boolean or void: %s", theHookMethod);
|
||||
Validate.isTrue(void.class.equals(returnType), "Method does not return boolean or void: %s", theHookMethod);
|
||||
myReturnsBoolean = false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue