Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Running AspectJ

Hi Andy!

the option -ShowEwaveInfo does not produce any additional output.

i try to quote my code:

LogCollector.aj:

import org.aspectj.lang.*;


aspect LogCollector {
	
	String klasse, methode = "";
	
	pointcut tueEtwas():
		execution (* *.*(..)) && !within(LogCollector);
	
	after() returning: tueEtwas() {
		Signature sig = thisJoinPointStaticPart.getSignature();
		klasse = sig.getDeclaringType().getName();
		methode = sig.getName();
		
		System.out.println("Entering: "+klasse+","+methode);
	}
	
}	
*********************************************************************************

Class setter.java:

public class setter {
	
private String id = "";
	
	public void setId(String id) {
		this.id = id;
	}
	
	public String getId() {
		return this.id;
	}
	
}


**************************************************************************************+
and the main class Test2.java:


public class Test2 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Test2 test2 = new Test2();
		test2.test();
		// TODO Auto-generated method stub
	}

	public void test() {
		setter sett = new setter();
		sett.setId("5");
		System.out.println("ID: "+sett.getId());

**********************************************************************************

The program should output the two additional lines in the main class where
the methods setter.setId and setter.getId are executed.

Hope you can help me.

Roland


Andy Clement wrote:
> 
> Hi Roland,
> 
> What are you expecting it to do?  Have you written some pointcuts and
> advice in an aspect that you expect should apply when you run the Test
> program?  You can tell if weaving is occurring from the command line
> using 'ajc -showWeaveInfo *.java' - does that produce any extra
> output?  Are your aspects in a .java file or in a .aj file?
> 
> Andy.
> 
> On 02/04/07, Roland Piazzi <roland_piazzi@xxxxxxxxxxx> wrote:
>>
>>
>> Hi!
>>
>> I'm very new with aspectJ and I'm trying to run a program with
>>
>> ajc -classpath %aspectj_home% *.java
>>
>> and
>>
>> java Test
>>
>> it runs without errors, but within the output it forgets to put the
>> aspect-output.
>>
>> The program does function with eclipse.
>>
>> I've not modified inpath and aspectpath, should i do so?
>>
>> Excuse me because of the very easy question...
>>
>> I would be very thankful if someone could help me.
>>
>> roland
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>
>>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> 
> 

-- 
View this message in context: http://www.nabble.com/Running-AspectJ-tf3507798.html#a9807639
Sent from the AspectJ - users mailing list archive at Nabble.com.



Back to the top