Carsten Ziegeler created SLING-7800:
---------------------------------------

             Summary: 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
         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
(v7.6.3#76005)

Reply via email to