[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] AspectJ and memory management
|
Gregor Kiczales wrote:
These accessor methods should be in StateBlock, and having to
duplicate the methods in the aspect for the purpose of delegating
is not ok.
Well its certainly easy to put them in state block instead if you
want. What do you really want? Have them in StateBlock, in the Aspect?
Both?
Here's what I want:
* I want to write interfaces+interfaceImpl's.
* I want one (or more) aspects which adds the interface to classes
* When the interface methods are invoked, the aspect should delegate to
the interfaceImpl's. The interfaceImpl's must be accessed through a
factory/cache mechanism, for scalability reasons.
Also, there has to be a minimum of code per case where the
interface+interfaceImpl is added to a class. It is, for example, not ok
to have one method in the aspect per interface method which does
delegation. That delegation code is essentially a cross-cutting concern,
and should only be written once.
When we write our domain models I want to write three types of classes:
* Id classes. These identify a "set" of objects which "look the same",
and have no methods except getId() and appropriate Object.*
implementations (equals/hashCode/toString).
* Interfaces. These contain the domain model contracts.
* Implementations. These contain the domain model implementations of the
interfaces.
Then, when a "class" is constructed one first creates an id class. All
appropriate interfaces are then added to it through introduction. Again,
there are NO domain methods in the actual "class". All "functionality"
is added by introduction.
This is how we work today and it is working extremely well. I am
wondering whether this is possible with AspectJ. The requirement is that
1) it is possible 2) it is possible with very little code beyond the
above three types of classes 3) it can scale.
This is the main background for my questions on this topic.
Adrian's example code with the dispatch() method is actually quite close
as far as I can tell.
/Rickard