Le 4 juin 2010 à 11:24, Rickard Öberg a écrit :

> On 2010-06-04 16.56, Philippe Van Dyck wrote:
>> Rickard,
>> 
>> Would it be possible to raise an exception when a direct call is made
>> (not going through the proxy) ?
> 
> But if we're going to raise an exception, why not simply route the call 
> instead?

Indeed, a much better idea ;-)


> 
> I'm looking into solving this problem right now, and the idea I have is this: 
> I'll overload all public methods that are implemented in an interface. When 
> they are called the invocation is routed to the composite invoke() method. 
> Then, when the invocation chain is done it will invoke a substitute method 
> (e.g. call "foo" and I'll add a "_foo" method), which does this:
> public void _foo(String bar)
> {
>  super.foo(bar); // This is to avoid an infinite loop if Qi4j calls foo() 
> straight away.
> }
> 
> It's a bit messy though, and doing the method substitution is non-trivial. It 
> would be great if it was possible to do something like 
> method.getSuperMethod().invoke(), but there's no such thing. CGLIB managed to 
> hack it somehow, and I'm guessing they're doing something similar to the 
> above to make it work.
> 

I hope you won't need to dig cglib's hack !

If it works, and I am quite sure that you'll find a way.

Keep up the good work ! 


cheers,

phil
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to