Hi Maik, Unfortunately you can't currently say that in AspectJ. The best you could do is determine it yourself: advise the collection operations, and then in the advice check if the target of the call has the annotation. Maybe use a cache of objects you know are/arent annotated to avoid ongoing reflection (getAnnotation) costs.
cheers Andy On 22 July 2011 01:12, Maik Jablonski <[email protected]> wrote: > Hi, > > I'm currently working on a project which needs to advice collection > operations where the collections are marked via an annotation on field > level. Here's an example: > > public class Parent { > > @Config(constraints="...") > private List<Child> children = new ArrayList<Child>(); > > ... > > public void addChild(Child child) { > children.add(child); > } > } > > I now want to create some kind of pointcut for #addChild() (or > children.add()) based on the @Config annotation for the collection > (and not on the naming of the methods in the parent-class). I can > create a get-pointcut for the "children"-field and also one for > calling all operations on collections in general, but I need something > which combines these two pointcuts: advice all operations on > collections which are annotated on field level. > > Is this possible at all? Or does someone has a good idea which might > as workaround? > > Cheers, > Maik > _______________________________________________ > aspectj-users mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/aspectj-users > _______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users
