You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Justin Edelson (JIRA)" <ji...@apache.org> on 2017/12/12 15:43:02 UTC

[jira] [Closed] (SLING-7124) Allow PostConstruct method to return false to indicate that a model object should not be returned

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

Justin Edelson closed SLING-7124.
---------------------------------

> Allow PostConstruct method to return false to indicate that a model object should not be returned
> -------------------------------------------------------------------------------------------------
>
>                 Key: SLING-7124
>                 URL: https://issues.apache.org/jira/browse/SLING-7124
>             Project: Sling
>          Issue Type: Improvement
>          Components: Extensions
>            Reporter: Justin Edelson
>            Assignee: Justin Edelson
>             Fix For: Sling Models Impl 1.4.6
>
>         Attachments: SLING-7124.diff
>
>
> In cases where a model objects (as opposed to the adaptable Resources) need to be validated programmatically, the options at present are to have the PostConstruct method throw an Exception or to have a special method which clients use to determine if the object is valid. The former adds unnecessary noise to the log files and the latter puts undue complexity on clients.
> It should be possible to return {{false}} from the PostConstruct method and for this to be considered a signal for a null value to be returned from the adaptTo() method (without extra logging). For the createModel() cases, we can't return null and have to throw an exception.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)