today I want to write few words about Interception.
First of all one of the questions that requires consideration can be why we may need interception at all? Need in interception arises in cases when we have some kind of logic, that is dispersed around whole application. Some candidates for interception can be:
- Exception handling
- Performance collecting and analysis
etc.... . So, after knowing at which places interception can be used following statement can be considered as explanation: interception is inserting code between calling code and target object. Code can be inserted before or after method call. If code is inserted before call then we have access to input variables, if code is intercepted then we have access to output.
There are following types of interception ( at least interceptions that I was able to find )
- Instance interception
- Type interception