Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Generic Aspects

Hi,

I'm trying to create a generic aspect which can do thing without being type dependent. 

I'm trying to do the following to start:

Test.java

public class Test {
public Test() {


}


public void sayHello() {
System.out.println("Hello world!");
}


public static void main(String args[]) {
Test t = new Test();
t.sayHello();
}
}

Replicate.aj

public abstract aspect Replicate<T> {


protected pointcut replica();


T around() : replica() {


// do something


return(proceed());
}
}

ReplicateConcrete.aj

public aspect ReplicateConcrete extends Replicate {
protected pointcut replica() : call( Test.new() );
}

But i'm having an error in the concrete. Eclipse complains in the "public aspect ReplicateConcrete extends Replicate {" line but it doesnt tell what's the problem..


Can anyone give me some tips here?

Thx,

Nuno



Back to the top