@@ -263,10 +263,12 @@ public boolean hasHooks(POINTCUT thePointcut) {
263
263
return myRegisteredPointcuts .contains (thePointcut );
264
264
}
265
265
266
+ protected abstract Class <?> getBooleanReturnType ();
267
+
266
268
@ Override
267
269
public boolean callHooks (POINTCUT thePointcut , HookParams theParams ) {
268
270
assert haveAppropriateParams (thePointcut , theParams );
269
- assert thePointcut .getReturnType () == void .class || thePointcut .getReturnType () == boolean . class ;
271
+ assert thePointcut .getReturnType () == void .class || thePointcut .getReturnType () == getBooleanReturnType () ;
270
272
271
273
Object retValObj = doCallHooks (thePointcut , theParams , true );
272
274
return (Boolean ) retValObj ;
@@ -282,14 +284,14 @@ private Object doCallHooks(POINTCUT thePointcut, HookParams theParams, Object th
282
284
for (BaseInvoker nextInvoker : invokers ) {
283
285
Object nextOutcome = nextInvoker .invoke (theParams );
284
286
Class <?> pointcutReturnType = thePointcut .getReturnType ();
285
- if (pointcutReturnType .equals (boolean . class )) {
287
+ if (pointcutReturnType .equals (getBooleanReturnType () )) {
286
288
Boolean nextOutcomeAsBoolean = (Boolean ) nextOutcome ;
287
289
if (Boolean .FALSE .equals (nextOutcomeAsBoolean )) {
288
290
ourLog .trace ("callHooks({}) for invoker({}) returned false" , thePointcut , nextInvoker );
289
291
theRetVal = false ;
290
292
break ;
291
293
}
292
- } else if (pointcutReturnType .equals (void .class ) == false ) {
294
+ } else if (! pointcutReturnType .equals (void .class )) {
293
295
if (nextOutcome != null ) {
294
296
theRetVal = nextOutcome ;
295
297
break ;
@@ -349,7 +351,7 @@ private List<BaseInvoker> union(List<BaseInvoker>... theInvokersLists) {
349
351
350
352
List <BaseInvoker > retVal ;
351
353
352
- if (haveMultiple == false ) {
354
+ if (! haveMultiple ) {
353
355
354
356
// The global list doesn't need to be sorted every time since it's sorted on
355
357
// insertion each time. Doing so is a waste of cycles..
@@ -485,9 +487,9 @@ private HookInvoker(
485
487
myMethod = theHookMethod ;
486
488
487
489
Class <?> returnType = theHookMethod .getReturnType ();
488
- if (myPointcut .getReturnType ().equals (boolean . class )) {
490
+ if (myPointcut .getReturnType ().equals (getBooleanReturnType () )) {
489
491
Validate .isTrue (
490
- boolean . class .equals (returnType ) || void .class .equals (returnType ),
492
+ getBooleanReturnType () .equals (returnType ) || void .class .equals (returnType ),
491
493
"Method does not return boolean or void: %s" ,
492
494
theHookMethod );
493
495
} else if (myPointcut .getReturnType ().equals (void .class )) {
0 commit comments