advise.around()
Version 1.x
This is a convenience function to weave an around
advice based on advise().
Description
This is a shortcut function to weave one around
advice with an object’s method. Logically it is defined as:
1 2 3 4 5 |
|
It means that instead of:
1 2 3 |
|
It is possible to write a shorter version:
1
|
|
Advice function
Essentially it is the same as dcl.superCall(). It uses the same double function pattern, and its behavior is the same.
Returned value
Just like advise() it is based on, it returns an opaque object with a single method:
unadvise()
. Calling it without parameters removes all advices set with that call to advise()
.
In order to be compatible with general destruction mechanisms it defines one more method: destroy()
, which is
an alias to unadvise()
.
Notes
Don’t forget that around advices always follow the double function pattern:
1 2 3 |
|
See details in dcl.superCall(), dcl.advise(). and advise().