[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [aspectj-dev] Possible?
|
Hello Wes,
Thanks for the reply, I just subscribed to the dev list.
Do I have permission to submit to the aspectj-users@xxxxxxxxxxx
list without it going through the moderator first?
Ted
-----Original Message-----
From: Wes Isberg [mailto:wes@xxxxxxxxxxxxxx]
Sent: Tuesday, June 17, 2003 12:54 PM
To: aspectj-dev@xxxxxxxxxxx
Subject: Re: [aspectj-dev] Possible?
This is a good question for aspectj-users@xxxxxxxxxxx.
Remember that the object returned by the new B(..)
constructor call join point has to be of type B.
Anything else would violate type-safety.
Wes
Anagnost, Ted (MED, GEMS-IT) wrote:
> Give this situation:
>
> public class A
> {
> private B m_b;
>
> public void method()
> {
> m_b = new B( "Test" );
> m_b.method();
> }
> }
>
> public class B extends D
> {
> public B(String string)
> {
> }
>
> public void method()
> {
> }
> }
>
> public class C extends D
> {
> public C(String string)
> {
> }
>
> public void method()
> {
> }
> }
>
> Is it possible to change A so that when it tries to do this:
>
> m_b = new B( "Test" );
> m_b.method();
>
> it actually effectively does this:
>
> m_b = new C( "Test" );
> m_b.method(); // calls C's method()
>
> In other words can I used AspectJ to substitute another class C
> for class B (as long as it has the same inheritance model and public
> interface) without changing the original source code?
>
>
> If the above is impossible, a related question is:
>
> Can I create an aspect such that if there is a call to a method, that
> method call
> is redirected to another object (that has a method of the same
> signature) instead?
>
> And then when that other object's method call is finished, the
original
> object's
> method's code is bypassed altogether?
>
> Thanks,
>
> Ted
> _______________________________________________
> aspectj-dev mailing list
> aspectj-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-dev
>
_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-dev