[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] pointcut clash (?)
|
Hi,
I'm getting into troubles with an aspect that should drive a lazy loader for
complex data types:
pointcut lazyLoaderRequired( LazyLoading loadingProperties, FilteredLoader
mySelf ) :
(
get( @LazyLoading
Collection<StatefullDatabaseObject+>+ StatefullDatabaseObject+.* )
||
get( @LazyLoading Map<SerializableObject+,
DatabaseObject+>+ SerializableObject+.* )
||
get( @LazyLoading Map<SerializableObject+,
StatelessDatabaseObject+>+ SerializableObject+.* )
)
&&
@annotation( loadingProperties )
&&
this( mySelf )
&&
(! execution( public void
FilteredLoader.loadFilteredData(Class) ) )
&&
(! cflow(adviceexecution()) )
;
the above pointcut intercepts get calls and evaluates if the lazy loading
should happen (or not, if it has been already performed):
before( LazyLoading loadingProperties, FilteredLoader mySelf) :
lazyLoaderRequired( loadingProperties, mySelf) {
// perform standard lazy loading
this.performLazyLoading(loadingProperties, mySelf, false);
}
Now I've got situations where I want lazy loading to be disabled, so I wrote
another pointcut that partially override the above one:
pointcut lazyLoaderForced( LazyLoading loadingProperties, FilteredLoader
mySelf) :
cflow( lazyLoaderRequired( loadingProperties, mySelf) )
&&
(
execution( public boolean DatabaseDialog+.perform*() throws
DatabaseException )
||
withincode( public JComboBox QueryElements.*(..) )
||
execution( * DatabaseDialog+.*(..) )
)
;
and defined another advice that should be triggered by the above pointcut:
before( LazyLoading loadingProperties, FilteredLoader mySelf ):
lazyLoaderForced( loadingProperties, mySelf) {
// perform forced lazy loading
this.performLazyLoading(loadingProperties, mySelf, true);
}
Now what should happen is that a method of QueryElements is adviced by the
lazy loader required pointcut, and eclipse confirms this. However, what happen
observing the running code is that the lazyLoaderRequired pointcut is always
triggered. I suspect this is due to the fact that two pointcuts are
overlapping, but I've tried also to isolate the statements of a lazy loading
required but the program always executes the required pointcut/advice.
Any idea about the problem?
Thanks,
Luca