[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [aspectj-dev] Can I "generate" with aspectJ
|
The closest you can get today is to use JET or a similar tool in
conjunction with AspectJ in order to have JET generate the inter-type
declaring aspects.
More information about JET can be found in the following articles:
http://www.eclipse.org/articles/Article-JET/jet_tutorial1.html
http://www.eclipse.org/articles/Article-JET2/jet_tutorial2.html
There are no current plans to provide a facility of the kind you ask for
within AspectJ directly.
-- Adrian
Adrian_Colyer@xxxxxxxxxx
Ťavoda Pavel <Pavel.Tavoda@xxxxxxxxxx>
Sent by: aspectj-dev-admin@xxxxxxxxxxx
25/05/2004 09:36
Please respond to
aspectj-dev
To
<aspectj-dev@xxxxxxxxxxx>
cc
Subject
RE: [aspectj-dev] Can I "generate" with aspectJ
Can I do it generally?
Something like: generate getter and setter for all public fields.
Best will be if I can combine it with Tiger metadata:
public class User {
@field private String firstName;
@field private String ...;
...
}
will be transformed to
public class User {
private String firstName;
public String getFirstName() {return firstName;}
public void setFirstName(String pName) {firstname=pName};
private String ...
}
for any number of fields and classes with one aspect.
Is something like this scheduled for future releases?
Thank you
-----Original Message-----
From: aspectj-dev-admin@xxxxxxxxxxx
[mailto:aspectj-dev-admin@xxxxxxxxxxx]On Behalf Of Adrian Colyer
Sent: Tuesday, May 25, 2004 10:08 AM
To: aspectj-dev@xxxxxxxxxxx
Subject: Re: [aspectj-dev] Can I "generate" with aspectJ
You can use inter-type declarations as follows:
public class info {
public String firstName;
}
public aspect InfoProperties {
public String info.getFirstName() {}
public void info.setFirstName(String fName) { firstName = fName; }
}
You can't make the public field in "info" suddenly become private, but you
could use a declare warning to achieve a similar effect. To the
InfoProperties aspect add the following:
declare warning ; set(* info.firstName) && !within(InfoProperties)
: "Only update firstName via the setter method.";
-- Adrian
Adrian_Colyer@xxxxxxxxxx
Ťavoda Pavel <Pavel.Tavoda@xxxxxxxxxx>
Sent by: aspectj-dev-admin@xxxxxxxxxxx
25/05/2004 08:19
Please respond to
aspectj-dev
To
<aspectj-dev@xxxxxxxxxxx>
cc
Subject
[aspectj-dev] Can I "generate" with aspectJ
I would like to generate some methods inside java class. For example:
SRC:
public class info {
public String firstName;
}
After weaving:
public class info {
private String firstName;
public String getFirstName() {
}
public void setFirstName(String pName) {
firstName=pName;
}
}
Is something like this feasible with AspectJ?
TNX
Pavel Tavoda
_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-dev
_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-dev