Justin Edelson created SLING-7124: ------------------------------------- Summary: 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
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)