Re: Scope of AOP..

Walter Cazzola <[email protected]>
Newsgroups gmane.comp.programming.aspect.general
Message-ID <[email protected]>
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 [email protected] Ph.: +39 010 353 6637  Fax: +39 010 353 6699
· · · --------------------------- · · · --------------------------- · · ·
                ... recursive: adjective, see recursive ...
· · · --------------------------- · · · --------------------------- · · ·

__________________________________________________
AOSD Discuss mailing list    -    [email protected]
To unsubscribe go to http://aosd.net

Check out the AOSD.net Wiki: http://aosd.net/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.