Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] staticinitializer

Jake,

The easiest way that I know of is that either all the class inherit from the
same parent class that would contain the attribute x and you define your
pointcut using that parent class as the target or you define and interface
that contains x and that is the target of the operation.  Without seeing
your aspect and the classes A, B and C, it hard for me to give you more
concrete example.

I hope this helps.

Later,

Ron

-----Original Message-----
From: Jake Whitehill [mailto:jrw@xxxxxxxx] 
Sent: Thursday, February 06, 2003 4:14 AM
To: 'aspectj-users@xxxxxxxxxxx'
Subject: RE: [aspectj-users] staticinitializer


Hi Ron,

Thanks for your response. I actually knew how to obtain the r-value, but
it's the l-value that I'm unsure about: what expression can I enter to refer
to each of A, B, and C (from my example) at the same time? Keep in mind, my
goal is to write one line of code that causes A.x = "A", that causes B.x =
"B", and that causes C.x = "C".

Any ideas?

Jake


On Wed, 5 Feb 2003, DiFrango, Ron wrote:

> Jake,
>
> You should be able to use:
>
> 	thisJoinPointStaticPart.getSignature().getDeclaringType()
>
> This should give the java.lang.Class of the current class that the 
> join point is executing within.
>
> Hope this helps.
>
> Ron
>
> -----Original Message-----
> From: Jake Whitehill [mailto:jrw@xxxxxxxx]
> Sent: Wednesday, February 05, 2003 2:08 PM
> To: aspectj-users@xxxxxxxxxxx
> Subject: [aspectj-users] staticinitializer
>
>
> Hi,
>
> I'm trying to implement the following:
>
> I have three classes A, B, and C. In all three classes the static 
> variable x appears. I want to use advice to write static-initializer 
> code for A, B, and C which initializes the value of x to some 
> class-dependent value. For instance, I'd really like to have:
>
> A.x = "A", B.x = "B", and C.x = "C"
>
> But I don't know how to refer to the actual class being initialized 
> from within the static initializer.
>
> Any suggestions?
>
> Thanks
> Jake
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx 
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
>
> **********************************************************************
> ****
> The information transmitted herewith is sensitive information intended
only
> for use by the individual or entity to which it is addressed. If the
reader
> of this message is not the intended recipient, you are hereby notified
that
> any review, retransmission, dissemination, distribution, copying or other
> use of, or taking of any action in reliance upon this information is
> strictly prohibited. If you have received this communication in error,
> please contact the sender and delete the material from your computer.
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
>
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users
 
**************************************************************************
The information transmitted herewith is sensitive information intended only
for use by the individual or entity to which it is addressed. If the reader
of this message is not the intended recipient, you are hereby notified that
any review, retransmission, dissemination, distribution, copying or other
use of, or taking of any action in reliance upon this information is
strictly prohibited. If you have received this communication in error,
please contact the sender and delete the material from your computer.


Back to the top