I agree that this is orthogonal to Sling Models. But I would say that
the importance of this new syntatic sugar is a bit lower now. Given
the lack of consensus and the (very valid) concern about how having
too many ways of doing similar things, I think we should put this on
hold (which I guess it was already).

Justin

On Tue, Jun 17, 2014 at 5:35 AM, Bertrand Delacretaz
<bdelacre...@apache.org> wrote:
> Hi,
>
> See SLING-2938 for the history and prototypes of simplified adapters,
> example below.
>
> Do we still need this with Sling Models?
> I'd say both things are orthogonal, but I haven't worked with models
> so far, so I'd like a second opinion - let's not introduce too many
> different ways of doing the same thing.
>
> -Bertrand
>
>
> Example adapter, defined by the (controversial) AdapterProvider
> interface, and @Adapter annotations:
>
> public static class MultipleMethodsProvider implements AdapterProvider {
>
>         @Adapter
>         public Integer adaptToInt(TestAdaptable src) {
>             return new Integer((int)src.value);
>         }
>
>         @Adapter
>         public URL adaptToURL(TestAdaptable src) {
>             final String url = "http://example.com/"; + src.value;
>             try {
>                 return new URL(url);
>             } catch(MalformedURLException mfu) {
>                 throw new RuntimeException("Invalid URL " + url, mfu);
>             }
>         }
>     }

Reply via email to