Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AspectJ » Declare parents in concrete aspect?
Declare parents in concrete aspect? [message #70428] Tue, 14 August 2007 14:21 Go to next message
Eclipse UserFriend
Originally posted by: martin.frey.logicacmg.com

Hi
to make a long story short i have two aspects. A abstract, B concrete of A.
A defines a general PropertyChangeSupport handler but it should not define
which classes should get woven at loadtime. Thats why the concrete aspect B
is there to define this.
I don't know why this shouldnt work. Since other concrete aspects work
perfectly. Are there some known issues regarding the "declare parents"
functionality?

If i define the declare parents directly in BeanChangeDefinitions all works
as expected. But i want to be able to use this aspect for multiple plugins.
So i dont want to use a concrete aspect to define the within package stuff.

Did someone solve this problem already?

regards Martin


Here's the code of the two aspects.
---------------------------------------------
public abstract aspect BeanChangeDefinitions {
// Add PropertyChangeSupport variable
private PropertyChangeSupport
PropertyChangeNotifier.propertyChangeSupport;

public void
PropertyChangeNotifier.addPropertyChangeListener(PropertyCha ngeListener
listener) {
propertyChangeSupport.addPropertyChangeListener(listener);
}
public void PropertyChangeNotifier.addPropertyChangeListener(String
propertyName, PropertyChangeListener listener) {
propertyChangeSupport.addPropertyChangeListener(propertyName ,
listener);
}
public void
PropertyChangeNotifier.removePropertyChangeListener(Property ChangeListener
listener) {
propertyChangeSupport.removePropertyChangeListener(listener) ;
}
public void PropertyChangeNotifier.removePropertyChangeListener(String
propertyName, PropertyChangeListener listener) {
propertyChangeSupport.removePropertyChangeListener(propertyN ame,listener);
}
public void PropertyChangeNotifier.firePropertyChange(String
propertyName,Object oldValue, Object newValue) {
propertyChangeSupport.firePropertyChange(propertyName,
oldValue,newValue);
}
public void PropertyChangeNotifier.createPropertyChangeSupport() {
propertyChangeSupport = new PropertyChangeSupport(this);
}

private pointcut createBean() : execution(new(..)) && withinBean();
private pointcut propertyChange() : set(* *) && !set(static * *) &&
withinBean();
public abstract pointcut withinBean();
after() : propertyChange() {
String sigName = thisJoinPoint.getSignature().getName();
Object newValue = thisJoinPoint.getArgs()[0];
PropertyChangeNotifier bean = (PropertyChangeNotifier)
thisJoinPoint.getThis();
bean.firePropertyChange(sigName, "", newValue);
}
after() : createBean() {
PropertyChangeNotifier bean = (PropertyChangeNotifier)
thisJoinPoint.getThis();
bean.createPropertyChangeSupport();
}
}
---------------------------------------------

public aspect ConcreteBeanChangeDefinitions extends BeanChangeDefinitions {
declare parents : models.* implements PropertyChangeNotifier;
public pointcut withinBean() : within(models.*);
}
Re: Declare parents in concrete aspect? [message #70448 is a reply to message #70428] Thu, 16 August 2007 09:11 Go to previous message
Eclipse UserFriend
Originally posted by: martin.frey.logicacmg.com

Never mind
I've solved this problem by using annotation based definitions.



"Martin Frey" <martin.frey@logicacmg.com> wrote in message
news:f9sdpa$9qf$1@build.eclipse.org...
> Hi
> to make a long story short i have two aspects. A abstract, B concrete of
> A. A defines a general PropertyChangeSupport handler but it should not
> define which classes should get woven at loadtime. Thats why the concrete
> aspect B is there to define this.
> I don't know why this shouldnt work. Since other concrete aspects work
> perfectly. Are there some known issues regarding the "declare parents"
> functionality?
>
> If i define the declare parents directly in BeanChangeDefinitions all
> works as expected. But i want to be able to use this aspect for multiple
> plugins. So i dont want to use a concrete aspect to define the within
> package stuff.
>
> Did someone solve this problem already?
>
> regards Martin
>
>
> Here's the code of the two aspects.
> ---------------------------------------------
> public abstract aspect BeanChangeDefinitions {
> // Add PropertyChangeSupport variable
> private PropertyChangeSupport
> PropertyChangeNotifier.propertyChangeSupport;
>
> public void
> PropertyChangeNotifier.addPropertyChangeListener(PropertyCha ngeListener
> listener) {
> propertyChangeSupport.addPropertyChangeListener(listener);
> }
> public void PropertyChangeNotifier.addPropertyChangeListener(String
> propertyName, PropertyChangeListener listener) {
> propertyChangeSupport.addPropertyChangeListener(propertyName ,
> listener);
> }
> public void
> PropertyChangeNotifier.removePropertyChangeListener(Property ChangeListener
> listener) {
> propertyChangeSupport.removePropertyChangeListener(listener) ;
> }
> public void PropertyChangeNotifier.removePropertyChangeListener(String
> propertyName, PropertyChangeListener listener) {
>
> propertyChangeSupport.removePropertyChangeListener(propertyN ame,listener);
> }
> public void PropertyChangeNotifier.firePropertyChange(String
> propertyName,Object oldValue, Object newValue) {
> propertyChangeSupport.firePropertyChange(propertyName,
> oldValue,newValue);
> }
> public void PropertyChangeNotifier.createPropertyChangeSupport() {
> propertyChangeSupport = new PropertyChangeSupport(this);
> }
>
> private pointcut createBean() : execution(new(..)) && withinBean();
> private pointcut propertyChange() : set(* *) && !set(static * *) &&
> withinBean();
> public abstract pointcut withinBean();
> after() : propertyChange() {
> String sigName = thisJoinPoint.getSignature().getName();
> Object newValue = thisJoinPoint.getArgs()[0];
> PropertyChangeNotifier bean = (PropertyChangeNotifier)
> thisJoinPoint.getThis();
> bean.firePropertyChange(sigName, "", newValue);
> }
> after() : createBean() {
> PropertyChangeNotifier bean = (PropertyChangeNotifier)
> thisJoinPoint.getThis();
> bean.createPropertyChangeSupport();
> }
> }
> ---------------------------------------------
>
> public aspect ConcreteBeanChangeDefinitions extends BeanChangeDefinitions
> {
> declare parents : models.* implements PropertyChangeNotifier;
> public pointcut withinBean() : within(models.*);
> }
>
Re: Declare parents in concrete aspect? [message #596315 is a reply to message #70428] Thu, 16 August 2007 09:11 Go to previous message
Martin Frey is currently offline Martin FreyFriend
Messages: 2
Registered: July 2009
Junior Member
Never mind
I've solved this problem by using annotation based definitions.



"Martin Frey" <martin.frey@logicacmg.com> wrote in message
news:f9sdpa$9qf$1@build.eclipse.org...
> Hi
> to make a long story short i have two aspects. A abstract, B concrete of
> A. A defines a general PropertyChangeSupport handler but it should not
> define which classes should get woven at loadtime. Thats why the concrete
> aspect B is there to define this.
> I don't know why this shouldnt work. Since other concrete aspects work
> perfectly. Are there some known issues regarding the "declare parents"
> functionality?
>
> If i define the declare parents directly in BeanChangeDefinitions all
> works as expected. But i want to be able to use this aspect for multiple
> plugins. So i dont want to use a concrete aspect to define the within
> package stuff.
>
> Did someone solve this problem already?
>
> regards Martin
>
>
> Here's the code of the two aspects.
> ---------------------------------------------
> public abstract aspect BeanChangeDefinitions {
> // Add PropertyChangeSupport variable
> private PropertyChangeSupport
> PropertyChangeNotifier.propertyChangeSupport;
>
> public void
> PropertyChangeNotifier.addPropertyChangeListener(PropertyCha ngeListener
> listener) {
> propertyChangeSupport.addPropertyChangeListener(listener);
> }
> public void PropertyChangeNotifier.addPropertyChangeListener(String
> propertyName, PropertyChangeListener listener) {
> propertyChangeSupport.addPropertyChangeListener(propertyName ,
> listener);
> }
> public void
> PropertyChangeNotifier.removePropertyChangeListener(Property ChangeListener
> listener) {
> propertyChangeSupport.removePropertyChangeListener(listener) ;
> }
> public void PropertyChangeNotifier.removePropertyChangeListener(String
> propertyName, PropertyChangeListener listener) {
>
> propertyChangeSupport.removePropertyChangeListener(propertyN ame,listener);
> }
> public void PropertyChangeNotifier.firePropertyChange(String
> propertyName,Object oldValue, Object newValue) {
> propertyChangeSupport.firePropertyChange(propertyName,
> oldValue,newValue);
> }
> public void PropertyChangeNotifier.createPropertyChangeSupport() {
> propertyChangeSupport = new PropertyChangeSupport(this);
> }
>
> private pointcut createBean() : execution(new(..)) && withinBean();
> private pointcut propertyChange() : set(* *) && !set(static * *) &&
> withinBean();
> public abstract pointcut withinBean();
> after() : propertyChange() {
> String sigName = thisJoinPoint.getSignature().getName();
> Object newValue = thisJoinPoint.getArgs()[0];
> PropertyChangeNotifier bean = (PropertyChangeNotifier)
> thisJoinPoint.getThis();
> bean.firePropertyChange(sigName, "", newValue);
> }
> after() : createBean() {
> PropertyChangeNotifier bean = (PropertyChangeNotifier)
> thisJoinPoint.getThis();
> bean.createPropertyChangeSupport();
> }
> }
> ---------------------------------------------
>
> public aspect ConcreteBeanChangeDefinitions extends BeanChangeDefinitions
> {
> declare parents : models.* implements PropertyChangeNotifier;
> public pointcut withinBean() : within(models.*);
> }
>
Previous Topic:Declare parents in concrete aspect?
Next Topic:Deploy Aspectj plugin/fragment as part of a feature
Goto Forum:
  


Current Time: Thu Apr 18 23:16:43 GMT 2024

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

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

Back to the top