Package org.refcodes.interceptor
Interface Interceptor<WP>
-
- Type Parameters:
WP
- The work piece which is being passed to the implementing interceptor and which is processed by the interceptor.
- All Known Implementing Classes:
CompositeSequentialInterceptorImpl
public interface Interceptor<WP>
An interceptor to manufacture a work piece object. This can be achieved within several steps. Then them steps each can be implemented by a dedicated interceptor being invoked one after the other with a given work piece object. After invocation of the interceptors and after an interceptor flagged completion of the work piece, then the work piece is considered to be finished. Interceptors might be arranged in a production line manner (one interceptor is invoked after the other) or construction of the participating interceptors might by achieved using the composite pattern. Having the according implementations of e.g. sequential interceptors, then individual nested interceptor structures may be constructed.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
doIntercept(WP aWorkPiece)
This method is invoked with a work as argument.
-
-
-
Method Detail
-
doIntercept
boolean doIntercept(WP aWorkPiece) throws WorkPieceException
This method is invoked with a work as argument. The method processes the work piece in order to finish the work piece. In case the interceptor is able to finish the the work piece then this is indicated by returning true. In case false is returned, then the work piece is considered not to be finished.- Parameters:
aWorkPiece
- The work piece which is to be processed by the interceptor.- Returns:
- True in case the interceptor managed to "finish" the work piece. In such a case subsequent interceptors may not be required to be invoked. In such a case the interceptor signals "finished". In case the interceptor did not finish the work piece or is unsure whether the work piece is finished, then false is returned.
- Throws:
WorkPieceException
- In case the interceptor was not able to work with the provided work piece, then an according work piece exception is thrown.
-
-