[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
|
- From: "Andrew Eisenberg" <andrew@xxxxxxxxxxxx>
- Date: Thu, 26 Jun 2008 20:10:04 -0700
- Delivered-to: aspectj-users@eclipse.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to :sender:to:subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=I5FloSnGVxiWnqLhIOR7DHKTOQPgLr4/KRXdJ0/afIQ=; b=nO8lUF0vlS+LyWCRYiFRC3wU67c98l2rJBqFEdVDdYnw6sM1Hcu+RCcMl3TwttMD3k JEK5VOIzXxAl/nWcwjIpYSg4yr0BlRx1W5b2bba2Spn0KNQUZvlOk7lz4UTfik+UJm2H 7FIChm4atE67kHKyXqwYi2ElHvvamGboQADBE=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:sender:to:subject:in-reply-to :mime-version:content-type:content-transfer-encoding :content-disposition:references:x-google-sender-auth; b=I4t9fGwa4YoejScRXMK8GjZz2icpP6XvNosE/54dkmZMm4m6OzJOmF+uO7a+tkulgf 1PQ8slPsXnJIaKUQ8oSQyJaNOXTuO6Hy8wTw0sjNx0rPn38MpaAw05kcNUizuRXqbprK CtoAAHX6KUAB5WKwgDE0CMz2NlTD89l1NPajk=
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
>