I mean if you do something like this:

@PluginElement("Layout")
@Required
private Layout layout = PatternLayout.defaultLayout();

Then it should work. But if you defer the creation of a default layout
until you execute the build() method, then the validator will err out
before build() is called.

On 11 September 2016 at 21:20, Gary Gregory <garydgreg...@gmail.com> wrote:

> HI Matt,
>
> Right now, all of the build() methods handle null layouts by using a
> default layout. That works for programmatic configs. But in order for that
> to work from a config file, the @Required needs to be removed.
>
> I feel like I am not understanding something in your message :-(
>
> Gary
>
> On Sun, Sep 11, 2016 at 11:43 AM, Matt Sicker <boa...@gmail.com> wrote:
>
>> I thought that @Required would check the field at build time, not
>> injection time. If the field was set to null, then you're going to have a
>> bad time.
>>
>> On 11 September 2016 at 10:50, Gary Gregory <garydgreg...@gmail.com>
>> wrote:
>>
>>> I forgot to say that:
>>>
>>> org.apache.logging.log4j.core.appender.ConsoleAppender.Builder.build()
>>> org.apache.logging.log4j.core.appender.FileAppender.Builder.build()
>>> org.apache.logging.log4j.core.appender.RollingFileAppender.B
>>> uilder.build()
>>> org.apache.logging.log4j.core.appender.SocketAppender.Builder.build()
>>>
>>> All provide default layouts.
>>>
>>> Gary
>>>
>>>
>>> On Sun, Sep 11, 2016 at 8:48 AM, Gary Gregory <garydgreg...@gmail.com>
>>> wrote:
>>>
>>>> I'm pretty sure we no longer need @Required on layout on
>>>> org.apache.logging.log4j.core.appender.AbstractAppender.Builder.layout.
>>>>
>>>> Would it be OK to say that an appender should provide a default layout?
>>>>
>>>> Gary
>>>>
>>>> --
>>>> E-Mail: garydgreg...@gmail.com | ggreg...@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
>>>>
>>>
>>>
>>>
>>> --
>>> E-Mail: garydgreg...@gmail.com | ggreg...@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 <boa...@gmail.com>
>>
>
>
>
> --
> E-Mail: garydgreg...@gmail.com | ggreg...@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 <boa...@gmail.com>

Reply via email to