logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Sicker <boa...@gmail.com>
Subject Re: org.apache.logging.log4j.core.config.plugins.PluginAttribute.required()
Date Mon, 07 Jul 2014 22:57:19 GMT
I support this. Should be added to @PluginAttribute and
@PluginBuilderAttribute or whatever it's called.


On 7 July 2014 11:06, Ralph Goers <ralph.goers@dslextreme.com> wrote:

> Seems reasonable to me.
>
> Ralph
>
> On Jul 7, 2014, at 8:35 AM, Gary Gregory <garydgregory@gmail.com> 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: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> <http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>
>
>


-- 
Matt Sicker <boards@gmail.com>

Mime
View raw message