This content has been marked as final.
Show 3 replies
-
1. Re: Pointcut expression for methods that take arrays as argu
bill.burke Jul 14, 2004 6:50 PM (in response to rkadayam)This should work
execution(void java.lang.Object[],com.pkg.CustomObject[])
Don't forget that any class, even if it is in java.lang package must be fully qualified.
Bill -
2. Re: Pointcut expression for methods that take arrays as argu
nthx Jul 29, 2004 6:00 AM (in response to rkadayam)Hi, there.
This is my first post after checking out JBossAOP, and implementing persistance and transaction layer for my POJOs with it.
So ...
Is it possible to intercept element-of-an-array assignment?
I mean://I'd like some code here (through Interceptor, of course) myArray[5] = newElement; //maybe I also would like some code 'around'.. //maybe sth like this: myArray[5] = getCachedMyElement; //or even 'after': UPDATE OBJECT_TABLE .... WHERE ...
And the binding in jboss-aop.xml, would look like this:<aop> <bind pointcut="array-element-set(myClass.myArray)"... <bind pointcut="array-element-get(myClass.myArray)" ... </aop>
If I had the functionality, then I would write persistance-layer with no limitations on collections classes, or whatever limitations existing persistance layers may have. More deeply: One would not write bindings for every collection class, i.e. collection.add(), collection.get(i)....
One would write generic persistance, by: intercepting every-variable-change-including-array-element-assignment.
And the real example of this is: java.util.ArrayList, where it stores data internally in an array:package java.util; public class ArrayList { private transient Object[] elementData ... public boolean add(Object o) { ensureCapacity(size + 1); // Increments modCount!! elementData[size++] = o; return true; } ...
I think you know what I mean now. I'd like to have simple<bind poincut="array-element-set(java.util.ArrayList->elementData)">
instead of binding, and implementing every "collection" class' method which manages data.
PS. Of course AspectJ also doesn't have functionality mentioned above, either -
3. Re: Pointcut expression for methods that take arrays as argu
bill.burke Aug 5, 2004 7:20 PM (in response to rkadayam)We don't support this. If you'd like to contribute it, it would be most welcome.
Bill