[ 
https://issues.apache.org/jira/browse/FELIX-3930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13678029#comment-13678029
 ] 

Pierre Bourret commented on FELIX-3930:
---------------------------------------

Here is a proposal for a new interception model : 
https://github.com/bourretp/felix/tree/feature/interception-api

It is based on the Interceptor pattern customized for POJOs.
Constructors & method invocations + field access can be intercepted, 
arguments/return value can be injected/changed/removed.
For methods, the real method invocation can be completely skipped (e.g. a 
cache-handler)
For constructors, the choice of the correct constructor to call depends on the 
actual type of the injected arguments. An error is raised if no suitable 
constructor can be found. A warning occurs if there is an ambiguity (and the 
"first" one is chosen)
For fields, nothing special, except that the injected values are _really_ put 
in the POJO fields... Really nice for debugging. All injected references are 
cleared when the component is stopped, to avoid keeping stale references of 
services and blocking bundle GC.

Documentation is _ongoing_, and implementation is still open to 
fixes/enhancement.

One _big_ blot : this proposition, especially changes in the manipulator, break 
compatibility with iPOJO components built with previous versions of the 
manipulator. Keeping this compatibility seems really complicated (at east).
So this feature cannot be integrated in the mainline now, and must wait for 
iPOJO version 2.0.0.
                
> New Interceptor model for handlers
> ----------------------------------
>
>                 Key: FELIX-3930
>                 URL: https://issues.apache.org/jira/browse/FELIX-3930
>             Project: Felix
>          Issue Type: Improvement
>          Components: iPOJO
>            Reporter: Clement Escoffier
>            Assignee: Clement Escoffier
>
> Define and implement a new interceptor model.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to