You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Carsten Ziegeler (Jira)" <ji...@apache.org> on 2021/10/28 04:55:00 UTC

[jira] [Resolved] (SLING-7800) Support OSGi converter in adaptTo

     [ https://issues.apache.org/jira/browse/SLING-7800?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carsten Ziegeler resolved SLING-7800.
-------------------------------------
    Resolution: Won't Fix

Clients can easily use the converter with the value map. So there is no real need to complicate our implementation

> Support OSGi converter in adaptTo
> ---------------------------------
>
>                 Key: SLING-7800
>                 URL: https://issues.apache.org/jira/browse/SLING-7800
>             Project: Sling
>          Issue Type: Improvement
>          Components: API
>            Reporter: Carsten Ziegeler
>            Priority: Major
>         Attachments: converter-patch.txt
>
>
> The OSGi Converter (https://osgi.org/specification/osgi.cmpn/7.0.0/util.converter.html) is a utility for converting an object into anything.
> In the context of Sling resources it might be very handy to use the converter to convert a resource (or the properties of a resource) into a data model (interface).
> Therefore we could think about supporting the Converter directly out of the box in adaptTo as all implementations inherit from the SlingAdaptable class.
> In order to get the properties of something, an adaptTo Map.class could be used.
> Attached is a simple patch demonstration this.
> This could be further improved, like leveraging the Resource#getValueMap method etc.



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