A MethodInterceptor is a simple interface that allows you to intercept ActionMethods before and after they have been invoked. This before and after interception provides AOP type of functionality.
Let's look at a simple example to obtain a clear idea of how this can be leveraged. Notice that in this example the boolean accept(Method) will only intercept calls to AutomobileController.accelerate(String) method. The intercept method below is a trivial example that ensures that the value to be invoke on the event is less than 50, if not that value is replaced with the value 0. Finally, the call to chain.proceed() allows for propogation to the next MethodInterceptor, or to actually invoking the ActionMethod. Of course if you did not want the ActionMethod to be invoke you would NOT call the proceed method (you could return different value or throw an Exception).
MethodInterceptor are registered with Waffle through the Registrar. So like other components in Waffle MethodInterceptors can take advantage of Dependency Injection.
You can ensure that your MethodInterceptors are called in a particular order by having them implement the org.codehaus.waffle.intercept.Sortable interface. Non-Sortable MethodInterceptors will be placed at the end of the InterceptorChain.