Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Capturing calls to annotated collections

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


Back to the top