Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] help and ideas on lazy loading thru aspectj

On Monday 27 October 2008 Andrew Eisenberg's cat, walking on the keyboard, 
wrote:
> Try using pertarget instead of perthis.  And inside the per clause
> should be a pointcut expression.  You'd want something like:
>
> pertarget(within(FilteredLoader+))  // with or without the '+'
>
> Also, you probably want to use  Collection<SerializableObject+>+ so
> that List and other sub-types will be matched.
>
> These problems should address your unbound formal argument problem,
> but let me know if you need further help.
>


Yes, I need a little help here.
I've got my target that extends SerializableObject and implements 
FilteredLoader, and has a few collections like
List<SerializableObject> list1;
HashMap<SerializableObject, Object> map1;
and so on. Each collection will be annotated with a LazyLoading annotation.
I wan to define a pointcut that catches all accesses to such 
SerializableObject-bound annotated collections, but I cannot find a way to 
define them:

  pointcut lazyLoadedRead( LazyLoading loadingProperties, FilteredLoader owner 
) : 
	                                                      get( @LazyLoading 
Collection<SerializableObject+>+ SerializableObject+.get* )
                                                              &&
                                                              @annotation(loadingProperties)
                                                              && 
                                                              target(owner)
                                                              ;

Any hint?

Thanks,
Luca


Back to the top