[aosd-discuss] Scope of AOP..
Walter Cazzola
cazzola at disi.unige.it
Sat Apr 8 10:44:46 EST 2006
On Thu, 6 Apr 2006, Pascal Costanza wrote:
>> Newbie in this topic. I have some sort of stupid wish.
>>
>> Can we tweak how the methods are called. May be instrumenting
>> objects and
>> method calls in runtime. And some sort of utility Class having
>> function as
>> CallStach [] getCallStack( Thread thread )
>> Where each elements in the CallStack[] represent the objects or the
>> classes involved on calling finally the aspect code.
>> I suppose core of the topic is having acess to the scope to the method
>> that generated the ( MyLogger.debug("Some debug statement"))
> What you wish for is available in a pretty straightforward way in
> Smalltalk: The call stack is a available as a linked list of objects
> representing stack frames, and the method tables are available as
> data structures as well. Method wrappers allow you to replace method
> table entries by, well, wrapping methods. For example, AspectS is
> built on top of these constructs.
The introspection stuff is available also in Java thanks to the Call Stack
Introspection:
StackTraceElement[] st = new Throwable().getStackTrace();
st will contains the current call stack and you can inspect every single
frame thanks to the reflective API.
Moreover if you read the Formans' book [1] you will find a reflective
solution to the short flexibility of the Logger problem. Of course it
could be easily used in combination to aspectj.
Just my 2 cents.
Walter
[1] Ira R. Forman and Nate B. Forman. Java Reflection in Action.
Manning Publications, October 2004.
--
Walter Cazzola, PhD - Assistant Professor, DICo, University of Milano
E-mail cazzola at disi.unige.it Ph.: +39 010 353 6637 Fax: +39 010 353 6699
· · · --------------------------- · · · --------------------------- · · ·
... recursive: adjective, see recursive ...
· · · --------------------------- · · · --------------------------- · · ·
More information about the discuss
mailing list