That is why programs that do programmatic configuration should use an API and 
not call the components directly

Sent from my iPad

> On Jul 8, 2014, at 6:56 PM, Gary Gregory <[email protected]> wrote:
> 
> Hm... if the error logging takes place in the plugin framework, then it 
> should be removed from the create() methods, but then apps that do 
> programmatic configuration will not benefit from the error logging. We would 
> then need to either keep the current guard clauses (with no logging) or 
> remove the guard clauses and let the chips fall where they may with NPEs.
> 
> Thoughts?
> 
> Gary
> 
> 
>> On Mon, Jul 7, 2014 at 11:35 AM, Gary Gregory <[email protected]> wrote:
>> Why don't we have a required flag?
>> 
>> Using it and throwing an Exception when this condition is violated would 
>> avoid guard code like:
>> 
>>     @PluginFactory
>>     public static RegexFilter createFilter(
>>             @PluginAttribute("regex") final Pattern regex,
>>             @PluginAttribute("useRawMsg") final Boolean useRawMsg,
>>             @PluginAttribute("onMatch") final Result match,
>>             @PluginAttribute("onMismatch") final Result mismatch) {
>> 
>>         if (regex == null) {
>>             LOGGER.error("A regular expression must be provided for 
>> RegexFilter");
>>             return null;
>>         }
>>         return new RegexFilter(useRawMsg, regex, match, mismatch);
>>     }
>> 
>> ?
>> 
>> -- 
>> E-Mail: [email protected] | [email protected] 
>> Java Persistence with Hibernate, Second Edition
>> JUnit in Action, Second Edition
>> Spring Batch in Action
>> Blog: http://garygregory.wordpress.com 
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
> 
> 
> 
> -- 
> E-Mail: [email protected] | [email protected] 
> Java Persistence with Hibernate, Second Edition
> JUnit in Action, Second Edition
> Spring Batch in Action
> Blog: http://garygregory.wordpress.com 
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory

Reply via email to