Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AspectJ » Is it possible to capture a newly initialized object in call pointcut?
Is it possible to capture a newly initialized object in call pointcut? [message #67025] Wed, 20 September 2006 23:13
Eclipse UserFriend
Originally posted by: canterburry.gmail.com

I am pretty new at this aspect stuff and have been reading one of the
Eclipse AspectJ Books. One of the passages concerning initializer pointcuts
states:

"When the method signature of a call expression specifies a constructor,
this will provide the instance (if the call is being made from a nonstatic
context) of the object making the constructor call. target is always
unbound-this means attempts to use it to match on a type or expose the
target of the call will leave you with a pointcut that does not match the
constructor call."

So, is it then at all possible to write a pointcut that both captures the
instance of the calling object and the instance of the object just created?

I would appreciate any alternatives.

i.e

What I really want to write is this:

pointcut newEventSource(ModelChangeEventSource source,
ModelChangeEventSource listener) :
call(ModelChangeEventSource+.new(..)) &&
this(listener+) &&
target(source+) &&
within(*.core.model.*);

after (OntoModelChangeEventSource source,
OntoModelChangeEventSourcelistener) returning :
newEventSource(source, listener)
{
source.addModelChangeListener(new ChangeListener (listener));
}

This basically says (or at least should say) if any event source
instantiates any new event source, then add the first source as a listener
to the newly created source.

This is for purposes of event propagation between event sources inside a
domain model.

Thanks
-HC
Previous Topic:RCP Plugins and AspectJ
Next Topic:Is it possible to capture a newly initialized object in call pointcut?
Goto Forum:
  


Current Time: Thu Apr 25 00:15:26 GMT 2024

Powered by FUDForum. Page generated in 0.02737 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top