Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Instance of aspect

Given

    public aspect Test {
        public static String methodName = "";
        ...
     }

This should work

   {  ... Test.methodName = "foo"; ... }

if Test is in the default package[1] and the class is on
your classpath at compile-time (when using javac or ajc)
or the source file is in the list of sources (when using
ajc).  If it doesn't work, please submit a bug.

Just be sure at runtime the Test class was the same Class
for your RMI server and any type affected by the aspect.
That's a matter of your particular system configuration.

Wes

[1] and not hidden by another unqualified type Test

varanasi kiran wrote:

Hi,
I have an aspect which has a static variable defined. I want to set the value to this static variable using a RMI Server class. Can anyone suggest how can I do this?

Since aspect is just another java class (logically), I tried to access the static varaiable to some value & it does not compile. I tried to compile using ajc, BTW.

Following is my aspect:

public aspect Test {
 public static String methodName = "";

 pointcut callServlet() : execution ( * javax.servlet..*.*(..) );

 before() : callServlet() {
   System.out.println(" Method Name: " + methodName );
 }
}

I tried to access "methodName" in RMI Server impl class as: Test.methodName.


Thanks in advance,

_________________________________________________________________
Keep up with the pace of change. Register for My Tech Ed. http://server1.msn.co.in/sp03/teched/index.asp Realise your potential!

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users




Back to the top