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 #596304] Tue, 14 August 2007 14:21
Martin Frey is currently offline Martin FreyFriend
Messages: 2
Registered: July 2009
Junior Member
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:Another internal NPE
Next Topic:Declare parents in concrete aspect?
Goto Forum:
  


Current Time: Fri Apr 19 23:42:03 GMT 2024

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

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

Back to the top