Implementations of this interface can be specified in the @AppliesTo.
AppliesTo filters are one of the driving technologies in Qi4j. They allow you to apply fragments (Mixins, Concerns, SideEffects), often generic ones, depending on the context that they are evaluated under. This mechanism is heavily used internally in Qi4j to achieve many other features.
The starting point is the basic use of AppliesToFilter, where the @AppliesTo annotation is given an AppliesToFilter implementation as an argument, for instance at a Mixin implementation;
@AppliesTo( MyAppliesToFilter.class ) public class SomeMixin implements InvocationHandler { } public class MyAppliesToFilter implements AppliesToFilter { public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> fragmentClass ) { return method.getName().startsWith( "my" ); } }
In the case above, the generic mixin will only be applied to the methods that that is defined by the AppliesToFilter. This is the primary way to define limits on the application of generic fragments, since especially mixins are rarely applied to all methods.