AspectJ 'around' advice - do you need to call continue?

It’s easy here, of course, someone knows this from the head ...

Question

When you write tip around in AspectJ, do you need to call next? Suppose you wanted to make a way to do something FULLY different? Can you leave "continue" or output an error (forcing you to cause a continuation, but ignoring the results)?

Example

can you do something like this:

String around() : generateCommand() { //never call proceed return getCommanMyOwnWayWithoutAccessingDatabase(); } 

or you need to do it like this:

 String around() : generateCommand() { String commandInvolvingInvalidDatabaseCall = proceed(); //completely ignore results from proceed return getCommanMyOwnWayWithoutAccessingDatabase(); } 
+4
source share
1 answer

Call continue () or continue (..) only if you want to call the functionality of your recommended method. Therefore, in your case, if you want to do something completely different, do not name it.

+8
source

All Articles