[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
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; }
> }
One minor note: the "getFirstName()" method implemented above should
"return firstName;".
This does bring up an question, though: Can public data be more
acceptable, in your opinion, in an aspect-oriented program? It could
actually be more or less synactic-sugar, because all gets/sets could be
pre-empted to call full advice bodies instead. The only disadvantage I
would see with public data like this is that it's harder to detect
invariants in you code: instead of merely seeing "oh, this is private, so
I need only look in this file" you would have to search for aspects
(which, if anyone follows me to this point, is another gotcha with AOP:
with inter-type declarations, many more invariant cases cannot be known
by just looking at a single file).
Thanks,
Macneil