You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Konrad Windszus (JIRA)" <ji...@apache.org> on 2014/06/27 09:47:24 UTC
[jira] [Commented] (SLING-3704) Custom injectors
[ https://issues.apache.org/jira/browse/SLING-3704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14045673#comment-14045673 ]
Konrad Windszus commented on SLING-3704:
----------------------------------------
This is already documented in http://sling.apache.org/documentation/bundles/models.html. Basically you just implement an OSGi-Service with a specific interface. That's all. No need to call bindInjector.
> Custom injectors
> ----------------
>
> Key: SLING-3704
> URL: https://issues.apache.org/jira/browse/SLING-3704
> Project: Sling
> Issue Type: Improvement
> Components: Extensions
> Affects Versions: Sling Models Implementation 1.0.6, Sling Models API 1.0.2
> Reporter: Krystian Panek
>
> In the future, I plan to create a custom injector for Sling Models. It would be great if documentation will have some section which describes how do it in a most simple way.
> Also API / Impl could be improved for that perspective of usage.
> I would like to use in my package following snippet which I found in unit tests:
> {quote}
> factory = new ModelAdapterFactory();
> factory.activate(componentCtx);
> factory.bindInjector(new MyCustomInjector(), new ServicePropertiesMap(1, 1));
> {quote}
> But methods in factory have protected scope and I cannot use them directly in my package without using a reflection.
> I realize that maybe custom injectors are not planned in design but I hope that suggested improvement could make SM more extensible.
--
This message was sent by Atlassian JIRA
(v6.2#6252)