I am interested in applying your idea.
Only, I quickly tried the sample eclipse project on your site and found that JGoodies throws an exception; it uses reflection to check that method addPropertyChangeListener exists, and it doesn't
Maybe something is missing in the sample?
If you get the exception stating that the bean does not support bound properties, then the Aspect is not being applied. When the aspect is applied, JGoodies will see that the bean does have the methods it's looking for. I design the aspect to work with the way JGoodies verifies that the bean supports bound properties.
How did you execute the example? Did you use the ant task or did you try and execute it from within Eclipse? If you're running the test class as a Java Application from within Eclipse, you'll need add a few VM params so that the aspects are applied at loadtime. You need to add:
-javaagent:/path/to/jboss/jboss-aop-jdk50.jar -Djboss.aop.class.path=/path/to/compiled aspect jar or class folder
Let me know if this helps any.
Yes this helps. Thanks for waking me up ;-)
How did you execute the example? Did you use the ant task or did you try and execute it from within Eclipse? If you're running the test class as a Java Application from within Eclipse, you'll need add a few VM params so that the aspects are applied at loadtime.
I am indeed running from Eclipse.
I added these VM args and then it worked as expected:
I like it! I am considering to applying this approach; not just for bound properties but also other generic services I may want to mix in.
Awesome! Glad it worked out for you. In hind sight, it probably took me about as much time to figure out how to create an aspect using Introductions as it would have for me to code property change support into each class. But now that it's built, I can use it on just about anything going forward. It's still got a few rough edges, but I'm wokring on 'em. Let me know if you see anything that could be changed/made better, etc.