[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] How to add a method to all classes in a package
|
Inter-type declarations can only have one target, but you can use a
declare parents statement.
You could do something like this
(http://www.eclipse.org/aspectj/doc/released/progguide/language-interType.html):
aspect A {
private interface HasName {}
declare parents: (Point || Line || Square) implements HasName;
private String HasName.name;
public String HasName.getName() { return name; }
}
On Thu, Jun 26, 2008 at 7:36 PM, Ashish Srivastava <ashish7s@xxxxxxxxx> wrote:
> Hi All,
> Is it possible to add (instrument) a method and its implementation to all the classes that I compile using ajc? If I have to add a method I do something like:
> public aspect TestAspect {
> public void Test.myMethod () {
> System.out.println ("My Method");
> }
> }
>
> But is it possible that I can add myMethod () to all the classes not necessarily just the Test?
>
> Thanks,
> -Ashish
>
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>