« Return to Thread: Best way to do AOP-like stunts?

Re: Best way to do AOP-like stunts?

by Robert Fischer :: Rate this Message:

Reply to Author | View in Thread

Perfection itself.

~~ Robert.

Ted Naleid wrote:

> It's hard to know without more details, but this approach might work for
> you:
>
> http://naleid.com/blog/2009/06/01/groovy-metaclass-overriding-a-method-whilst-using-the-old-implementation/
>
> It doesn't whack invokeMethod and simply uses the reference to the old
> method (whatever that may be).
>
> -Ted
>
> On Mon, Jun 22, 2009 at 12:15 PM, Robert Fischer
> <robert.fischer@...
> <mailto:robert.fischer@...>> wrote:
>
>     I'd like to wrap all calls into a particular library that contain a
>     particular type of argument, and
>     then do some adjustment to that argument before it continues
>     processing.  I specifically do *not*
>     want to override/define invokeMethod, because I suspect someone else
>     might be hijacking that for
>     their own nefarious purposes, and I'm concerned I'll trounce their
>     work (or vice versa).  What's the
>     best way to go about this?  If I iterate over the MetaMethods, I'm
>     not entirely sure how to redefine
>     the calls so that my new implementation can call the old
>     implementation with the appropriately
>     mangled argument.  Is there an idiom I should be using for this kind
>     of behavior?
>
>     What I really want is something like Java 7's method handles...
>
>     ~~ Robert Fischer, Smokejumper IT Consulting.
>     Enfranchised Mind Blog http://EnfranchisedMind.com/blog
>
>     Check out my book, "Grails Persistence with GORM and GSQL"!
>     http://www.smokejumperit.com/redirect.html
>
>
--
~~ Robert Fischer, Smokejumper IT Consulting.
Enfranchised Mind Blog http://EnfranchisedMind.com/blog

Check out my book, "Grails Persistence with GORM and GSQL"!
http://www.smokejumperit.com/redirect.html



signature.asc (201 bytes) Download Attachment

 « Return to Thread: Best way to do AOP-like stunts?