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

Alexander Klimetschek commented on SLING-3714:
----------------------------------------------

Another option as discussed on the list:
* do not change the Adaptable interface
* just add a static helper that checks for null result and throws in that case: 
{code}
Foo f = AdapterHelper.adaptOrThrow(Foo.class);
{code}

> Allow for a caller to request a non-null response from adaptTo()
> ----------------------------------------------------------------
>
>                 Key: SLING-3714
>                 URL: https://issues.apache.org/jira/browse/SLING-3714
>             Project: Sling
>          Issue Type: Improvement
>            Reporter: Justin Edelson
>
> See SLING-3709 for a Sling Models-specific request. As I commented there, I 
> think this makes more sense as a core change to the Adaptable interface.
> One option:
> resource.adaptTo(Result<Node>.class)
> Which returns a Result object, which has an API like:
> interface Result<T> {
> boolean isSuccess();
> T getObject();
> List<Error> getErrors();
> }



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to