[
https://issues.apache.org/jira/browse/SLING-7124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16168184#comment-16168184
]
Justin Edelson commented on SLING-7124:
---------------------------------------
Good point [~kwin]. Added this log message:
{code}
251 [main] DEBUG org.apache.sling.models.impl.ModelAdapterFactory -
PostConstruct method
org.apache.sling.models.testmodels.classes.FalsePostConstuctModel.pc returned
false. Returning null model.
{code}
> 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)