[
https://issues.apache.org/jira/browse/SLING-7124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16168094#comment-16168094
]
Konrad Windszus commented on SLING-7124:
----------------------------------------
Please add at least some logging with level DEBUG in case {{false}} has been
returned. Otherwise it is close to impossible to trace afterwards why a model
could not be retrieved. IMHO we must pay attention that Sling Model issues
don't get even more complicated to debug during development time.
> 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
> 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)