Declare parents in concrete aspect? [message #70428] |
Tue, 14 August 2007 14:21 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 |
Martin Frey 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.*);
> }
>
|
|
|
Powered by
FUDForum. Page generated in 0.04187 seconds