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 2020/09/13 16:36:00 UTC

[jira] [Comment Edited] (SLING-2938) AdapterMethods annotation and adapter proxy service

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

Konrad Windszus edited comment on SLING-2938 at 9/13/20, 4:35 PM:
------------------------------------------------------------------

This should IMHO be just a custom component property type as defined in OSGi DS 1.4 (https://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.component.html#service.component-component.property.types). This is slightly more verbose than the original proposal (as it requires implementing all adaptations with the same adaptTo method) but means zero overhead at run time. [~Henry Kuijpers] WDYT?

A similar approach was used in https://github.com/apache/sling-org-apache-sling-servlets-annotations


was (Author: kwin):
This should IMHO be just a custom component property type as defined in OSGi DS 1.4 (https://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.component.html#service.component-component.property.types). This is slightly more verbose than the original proposal (as it requires implementing all adaptations with the same adaptTo method) but means zero overhead at run time. [~Henry Kuijpers] WDYT?

> AdapterMethods annotation and adapter proxy service
> ---------------------------------------------------
>
>                 Key: SLING-2938
>                 URL: https://issues.apache.org/jira/browse/SLING-2938
>             Project: Sling
>          Issue Type: Bug
>          Components: Engine, Extensions
>    Affects Versions: Adapter 2.1.0
>            Reporter: Bertrand Delacretaz
>            Priority: Minor
>         Attachments: SLING-2938-api.patch, console.jpg
>
>
> Following up on an idea that Olaf Otto presented at CQCon last week, I've been working on an @AdapterMethod annotation that makes it easier to create Sling adapters, as in
>   @Component
>   @Service
>   public class MyAdapters implements AdapterMethodProvider {
>     @AdapterMethod
>     public Bar toBar(Foo f) { ... adapt Foo to Bar ... }
>   }
> As this requires changes to the sling.api bundle, I'll commit to my whiteboard first, for review



--
This message was sent by Atlassian Jira
(v8.3.4#803005)