Ok, cool. Rickard, what do you think?
I am leaning towards OR, as written in the AppliesTo annotation Javadoc. And that the AppliesTo "group" is ANDed with the TypedModifier for non-generic modifiers. Cheers On Fri, Oct 2, 2009 at 2:05 PM, Michael Hunger <[email protected]> wrote: > @AppliesTo({PropertyMixin.PropertyFilter.class,ManyAssociationMixin.AssociationFilter.class,AssociationMixin.AssociationFilter.class}) > public class EventLogSideEffect extends GenericSideEffect { > �...@service > EventLogService service; > > �...@override > public Object invoke(Object target, Method method, Object[] params) > throws Throwable { > final Object result = super.invoke(target, method, params); > service.logEvent(target,method,params,result); > return result; > } > // my workaround solution > public static class EventLogFilter implements AppliesToFilter { > final static Collection<AppliesToFilter> filters=asList(new > PropertyMixin.PropertyFilter(),new > ManyAssociationMixin.AssociationFilter(),new > AssociationMixin.AssociationFilter()); > > public boolean appliesTo(Method method, Class<?> mixin, Class<?> > compoisteType, Class<?> modifierClass) { > for (AppliesToFilter filter : filters) { > if > (filter.appliesTo(method,mixin,compoisteType,modifierClass)) return true; > } > return false; > } > } > } > > > Am 02.10.09 08:00, schrieb Niclas Hedhman: >> >> On Fri, Oct 2, 2009 at 1:50 PM, Michael Hunger<[email protected]> wrote: >>> >>> I had some trouble last night attaching (reusing) several AppliesToFilter >>> classes to a sideeffect. >>> >>> While the annotation doc says they are or'ed, so that if any of those >>> matches the Mixin is applied, the code in AbstractModifierDeclaration >>> uses >>> an AndAppliesTo composition to add up all the filters. Which naturally >>> fails >>> as the different filter classes are mutually exclusive. >>> >>> AMD: 104 : appliesToFilter = new AndAppliesToFilter( >>> appliesToFilter, filter ); >>> also in line 68: appliesToFilter = new >>> AndAppliesToFilter( >>> appliesToFilter, new ImplementsMethodAppliesToFilter() ); >>> >>> My workaround solution for the tutorial, was to provide a custom filter >>> that >>> manually or's a list of filters. >>> >>> But this wouldn't work with implicitely inherited applies to lists. >> >> Do you have some samples, so usecases can easier be discussed? >> >> I vaguely remember that this was discussed way back in time (Rickard's >> apartment in Orebro, 2007), and OR was selected, but the code was >> written later, at which point such could have been forgotten or some >> other usecase showed AND being more natural. >> >> >> Cheers > > > _______________________________________________ > qi4j-dev mailing list > [email protected] > http://lists.ops4j.org/mailman/listinfo/qi4j-dev > -- Niclas Hedhman, Software Developer http://www.qi4j.org - New Energy for Java I live here; http://tinyurl.com/2qq9er I work here; http://tinyurl.com/2ymelc I relax here; http://tinyurl.com/2cgsug _______________________________________________ qi4j-dev mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/qi4j-dev

