You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Gary Gregory <ga...@gmail.com> on 2014/06/02 18:15:37 UTC

Registering converters

If I want to register my own type converters with

org.apache.logging.log4j.core.config.plugins.util.TypeConverters.registerTypeConverter(Class<?>,
TypeConverter<?>)

when do I call it to make sure the configuration parsing picks up my
additions before it is to late?

Gary

-- 
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

Re: Registering converters

Posted by Matt Sicker <bo...@gmail.com>.
Well, what categories are we supposed to use? Is there a set list, or can
we just use whatever? It's not that clear other than looking at current
usage (most things are in the Core category).


On 3 June 2014 01:31, Ralph Goers <rg...@apache.org> wrote:

> A new annotation to do what? To specify which category the plugin belongs
> to? What is wrong with the way it is now? What problem are we trying to
> solve?
>
> Sent from my iPad
>
> On Jun 2, 2014, at 8:30 PM, Gary Gregory <ga...@gmail.com> wrote:
>
> A new annotation seems simpler to me but that might be contradictory to
> what Ralph had in mind when he created the framework. Hopefully, let us
> know ;-)
>
>
> Gary
>
>
> On Mon, Jun 2, 2014 at 11:23 PM, Matt Sicker <bo...@gmail.com> wrote:
>
>> Yeah, but now I'm wondering which approach to take. Re-use @Plugin, add
>> another annotation, or refactor how categories are handled in @Plugin.
>> Could be a mix of 1 and 3, with 3 coming later.
>>
>>
>> On 2 June 2014 22:00, Gary Gregory <ga...@gmail.com> wrote:
>>
>>> Welcome back Matt then.
>>>
>>> Are you putting yourself on deck to redo the type converters a la Log4j?
>>>
>>> Gary
>>>
>>>
>>> On Mon, Jun 2, 2014 at 10:55 PM, Matt Sicker <bo...@gmail.com> wrote:
>>>
>>>> Scratch that idea. It's using ASM. That's definitely not worth it.
>>>>
>>>>
>>>> On 2 June 2014 21:51, Matt Sicker <bo...@gmail.com> wrote:
>>>>
>>>>> I'm looking at how Spring does it, and for pre-1.8 code, it's quite
>>>>> the rabbit hole. I'll report back when I find my way out.
>>>>>
>>>>>
>>>>> On 2 June 2014 21:39, Gary Gregory <ga...@gmail.com> wrote:
>>>>>
>>>>>> On Mon, Jun 2, 2014 at 10:35 PM, Matt Sicker <bo...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Not for the factory/builder stuff! Unless we cached more data about
>>>>>>> plugins like that.
>>>>>>>
>>>>>>
>>>>>> Ah, I made an incorrect assumption then. Let's keep it simple and
>>>>>> require the name then? We can always enhance later.
>>>>>>
>>>>>> Gary
>>>>>>
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 2 June 2014 21:32, Gary Gregory <ga...@gmail.com> wrote:
>>>>>>>
>>>>>>>> It would only happen at compile time... so who cares?
>>>>>>>>
>>>>>>>> Gary
>>>>>>>>
>>>>>>>>
>>>>>>>> On Mon, Jun 2, 2014 at 10:29 PM, Matt Sicker <bo...@gmail.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> In regards to the parameter reflection stuff, I can't find
>>>>>>>>> anything in 1.6 other than using
>>>>>>>>> Introspector.getBeanInfo(Class<?>).getMethodDescriptors() and
>>>>>>>>> MethodDescriptor.getParameterDescriptors(). From what I recall,
>>>>>>>>> Introspector is rather slow for this sort of situation and is mostly used
>>>>>>>>> in GUIs that deal with JavaBeans.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 2 June 2014 21:20, Matt Sicker <bo...@gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> On 2 June 2014 21:14, Gary Gregory <ga...@gmail.com>
>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>> Well, my point is that you'd just use an annotation. What the
>>>>>>>>>>> annotation is, I do not know. I'm not crazy about the category idea in
>>>>>>>>>>> general because I am one typo away on a late night from getting stuck. If
>>>>>>>>>>> the code does not compile, that's easier to fix.
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> I agree on that. It's terribly frustrating to deal with runtime
>>>>>>>>>> problems that should have been detectable at compile time. Perhaps instead
>>>>>>>>>> of categories we had a meta-annotation that describes a plugin category,
>>>>>>>>>> and then plugins can use a category annotation instead of the parameter? We
>>>>>>>>>> could really use annotations like this to make things more typed with less
>>>>>>>>>> typing.
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Matt Sicker <bo...@gmail.com>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Matt Sicker <bo...@gmail.com>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> 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 <bo...@gmail.com>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> 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 <bo...@gmail.com>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Matt Sicker <bo...@gmail.com>
>>>>
>>>
>>>
>>>
>>> --
>>> 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 <bo...@gmail.com>
>>
>
>
>
> --
> 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 <bo...@gmail.com>

Re: Registering converters

Posted by Ralph Goers <rg...@apache.org>.
A new annotation to do what? To specify which category the plugin belongs to? What is wrong with the way it is now? What problem are we trying to solve?

Sent from my iPad

> On Jun 2, 2014, at 8:30 PM, Gary Gregory <ga...@gmail.com> wrote:
> 
> A new annotation seems simpler to me but that might be contradictory to what Ralph had in mind when he created the framework. Hopefully, let us know ;-)
> 
> 
> Gary
> 
> 
>> On Mon, Jun 2, 2014 at 11:23 PM, Matt Sicker <bo...@gmail.com> wrote:
>> Yeah, but now I'm wondering which approach to take. Re-use @Plugin, add another annotation, or refactor how categories are handled in @Plugin. Could be a mix of 1 and 3, with 3 coming later.
>> 
>> 
>>> On 2 June 2014 22:00, Gary Gregory <ga...@gmail.com> wrote:
>>> Welcome back Matt then.
>>> 
>>> Are you putting yourself on deck to redo the type converters a la Log4j?
>>> 
>>> Gary
>>> 
>>> 
>>>> On Mon, Jun 2, 2014 at 10:55 PM, Matt Sicker <bo...@gmail.com> wrote:
>>>> Scratch that idea. It's using ASM. That's definitely not worth it.
>>>> 
>>>> 
>>>>> On 2 June 2014 21:51, Matt Sicker <bo...@gmail.com> wrote:
>>>>> I'm looking at how Spring does it, and for pre-1.8 code, it's quite the rabbit hole. I'll report back when I find my way out.
>>>>> 
>>>>> 
>>>>>> On 2 June 2014 21:39, Gary Gregory <ga...@gmail.com> wrote:
>>>>>>> On Mon, Jun 2, 2014 at 10:35 PM, Matt Sicker <bo...@gmail.com> wrote:
>>>>>>> Not for the factory/builder stuff! Unless we cached more data about plugins like that.
>>>>>> 
>>>>>> Ah, I made an incorrect assumption then. Let's keep it simple and require the name then? We can always enhance later.
>>>>>> 
>>>>>> Gary
>>>>>>  
>>>>>>> 
>>>>>>> 
>>>>>>>> On 2 June 2014 21:32, Gary Gregory <ga...@gmail.com> wrote:
>>>>>>>> It would only happen at compile time... so who cares?
>>>>>>>> 
>>>>>>>> Gary
>>>>>>>> 
>>>>>>>> 
>>>>>>>>> On Mon, Jun 2, 2014 at 10:29 PM, Matt Sicker <bo...@gmail.com> wrote:
>>>>>>>>> In regards to the parameter reflection stuff, I can't find anything in 1.6 other than using Introspector.getBeanInfo(Class<?>).getMethodDescriptors() and MethodDescriptor.getParameterDescriptors(). From what I recall, Introspector is rather slow for this sort of situation and is mostly used in GUIs that deal with JavaBeans.
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>>> On 2 June 2014 21:20, Matt Sicker <bo...@gmail.com> wrote:
>>>>>>>>>>> On 2 June 2014 21:14, Gary Gregory <ga...@gmail.com> wrote:
>>>>>>>>>>> Well, my point is that you'd just use an annotation. What the annotation is, I do not know. I'm not crazy about the category idea in general because I am one typo away on a late night from getting stuck. If the code does not compile, that's easier to fix.
>>>>>>>>>> 
>>>>>>>>>> I agree on that. It's terribly frustrating to deal with runtime problems that should have been detectable at compile time. Perhaps instead of categories we had a meta-annotation that describes a plugin category, and then plugins can use a category annotation instead of the parameter? We could really use annotations like this to make things more typed with less typing.
>>>>>>>>>> 
>>>>>>>>>> -- 
>>>>>>>>>> Matt Sicker <bo...@gmail.com>
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> -- 
>>>>>>>>> Matt Sicker <bo...@gmail.com>
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> -- 
>>>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org 
>>>>>>>> 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
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> -- 
>>>>>>> Matt Sicker <bo...@gmail.com>
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> -- 
>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org 
>>>>>> 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
>>>>> 
>>>>> 
>>>>> 
>>>>> -- 
>>>>> Matt Sicker <bo...@gmail.com>
>>>> 
>>>> 
>>>> 
>>>> -- 
>>>> Matt Sicker <bo...@gmail.com>
>>> 
>>> 
>>> 
>>> -- 
>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org 
>>> 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
>> 
>> 
>> 
>> -- 
>> Matt Sicker <bo...@gmail.com>
> 
> 
> 
> -- 
> E-Mail: garydgregory@gmail.com | ggregory@apache.org 
> 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

Re: Registering converters

Posted by Gary Gregory <ga...@gmail.com>.
A new annotation seems simpler to me but that might be contradictory to
what Ralph had in mind when he created the framework. Hopefully, let us
know ;-)


Gary


On Mon, Jun 2, 2014 at 11:23 PM, Matt Sicker <bo...@gmail.com> wrote:

> Yeah, but now I'm wondering which approach to take. Re-use @Plugin, add
> another annotation, or refactor how categories are handled in @Plugin.
> Could be a mix of 1 and 3, with 3 coming later.
>
>
> On 2 June 2014 22:00, Gary Gregory <ga...@gmail.com> wrote:
>
>> Welcome back Matt then.
>>
>> Are you putting yourself on deck to redo the type converters a la Log4j?
>>
>> Gary
>>
>>
>> On Mon, Jun 2, 2014 at 10:55 PM, Matt Sicker <bo...@gmail.com> wrote:
>>
>>> Scratch that idea. It's using ASM. That's definitely not worth it.
>>>
>>>
>>> On 2 June 2014 21:51, Matt Sicker <bo...@gmail.com> wrote:
>>>
>>>> I'm looking at how Spring does it, and for pre-1.8 code, it's quite the
>>>> rabbit hole. I'll report back when I find my way out.
>>>>
>>>>
>>>> On 2 June 2014 21:39, Gary Gregory <ga...@gmail.com> wrote:
>>>>
>>>>> On Mon, Jun 2, 2014 at 10:35 PM, Matt Sicker <bo...@gmail.com> wrote:
>>>>>
>>>>>> Not for the factory/builder stuff! Unless we cached more data about
>>>>>> plugins like that.
>>>>>>
>>>>>
>>>>> Ah, I made an incorrect assumption then. Let's keep it simple and
>>>>> require the name then? We can always enhance later.
>>>>>
>>>>> Gary
>>>>>
>>>>>
>>>>>>
>>>>>>
>>>>>> On 2 June 2014 21:32, Gary Gregory <ga...@gmail.com> wrote:
>>>>>>
>>>>>>> It would only happen at compile time... so who cares?
>>>>>>>
>>>>>>> Gary
>>>>>>>
>>>>>>>
>>>>>>> On Mon, Jun 2, 2014 at 10:29 PM, Matt Sicker <bo...@gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> In regards to the parameter reflection stuff, I can't find anything
>>>>>>>> in 1.6 other than using
>>>>>>>> Introspector.getBeanInfo(Class<?>).getMethodDescriptors() and
>>>>>>>> MethodDescriptor.getParameterDescriptors(). From what I recall,
>>>>>>>> Introspector is rather slow for this sort of situation and is mostly used
>>>>>>>> in GUIs that deal with JavaBeans.
>>>>>>>>
>>>>>>>>
>>>>>>>> On 2 June 2014 21:20, Matt Sicker <bo...@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> On 2 June 2014 21:14, Gary Gregory <ga...@gmail.com> wrote:
>>>>>>>>>>
>>>>>>>>>> Well, my point is that you'd just use an annotation. What the
>>>>>>>>>> annotation is, I do not know. I'm not crazy about the category idea in
>>>>>>>>>> general because I am one typo away on a late night from getting stuck. If
>>>>>>>>>> the code does not compile, that's easier to fix.
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> I agree on that. It's terribly frustrating to deal with runtime
>>>>>>>>> problems that should have been detectable at compile time. Perhaps instead
>>>>>>>>> of categories we had a meta-annotation that describes a plugin category,
>>>>>>>>> and then plugins can use a category annotation instead of the parameter? We
>>>>>>>>> could really use annotations like this to make things more typed with less
>>>>>>>>> typing.
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Matt Sicker <bo...@gmail.com>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Matt Sicker <bo...@gmail.com>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> 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 <bo...@gmail.com>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> 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 <bo...@gmail.com>
>>>>
>>>
>>>
>>>
>>> --
>>> Matt Sicker <bo...@gmail.com>
>>>
>>
>>
>>
>> --
>> 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 <bo...@gmail.com>
>



-- 
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

Re: Registering converters

Posted by Matt Sicker <bo...@gmail.com>.
Yeah, but now I'm wondering which approach to take. Re-use @Plugin, add
another annotation, or refactor how categories are handled in @Plugin.
Could be a mix of 1 and 3, with 3 coming later.


On 2 June 2014 22:00, Gary Gregory <ga...@gmail.com> wrote:

> Welcome back Matt then.
>
> Are you putting yourself on deck to redo the type converters a la Log4j?
>
> Gary
>
>
> On Mon, Jun 2, 2014 at 10:55 PM, Matt Sicker <bo...@gmail.com> wrote:
>
>> Scratch that idea. It's using ASM. That's definitely not worth it.
>>
>>
>> On 2 June 2014 21:51, Matt Sicker <bo...@gmail.com> wrote:
>>
>>> I'm looking at how Spring does it, and for pre-1.8 code, it's quite the
>>> rabbit hole. I'll report back when I find my way out.
>>>
>>>
>>> On 2 June 2014 21:39, Gary Gregory <ga...@gmail.com> wrote:
>>>
>>>> On Mon, Jun 2, 2014 at 10:35 PM, Matt Sicker <bo...@gmail.com> wrote:
>>>>
>>>>> Not for the factory/builder stuff! Unless we cached more data about
>>>>> plugins like that.
>>>>>
>>>>
>>>> Ah, I made an incorrect assumption then. Let's keep it simple and
>>>> require the name then? We can always enhance later.
>>>>
>>>> Gary
>>>>
>>>>
>>>>>
>>>>>
>>>>> On 2 June 2014 21:32, Gary Gregory <ga...@gmail.com> wrote:
>>>>>
>>>>>> It would only happen at compile time... so who cares?
>>>>>>
>>>>>> Gary
>>>>>>
>>>>>>
>>>>>> On Mon, Jun 2, 2014 at 10:29 PM, Matt Sicker <bo...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> In regards to the parameter reflection stuff, I can't find anything
>>>>>>> in 1.6 other than using
>>>>>>> Introspector.getBeanInfo(Class<?>).getMethodDescriptors() and
>>>>>>> MethodDescriptor.getParameterDescriptors(). From what I recall,
>>>>>>> Introspector is rather slow for this sort of situation and is mostly used
>>>>>>> in GUIs that deal with JavaBeans.
>>>>>>>
>>>>>>>
>>>>>>> On 2 June 2014 21:20, Matt Sicker <bo...@gmail.com> wrote:
>>>>>>>
>>>>>>>> On 2 June 2014 21:14, Gary Gregory <ga...@gmail.com> wrote:
>>>>>>>>>
>>>>>>>>> Well, my point is that you'd just use an annotation. What the
>>>>>>>>> annotation is, I do not know. I'm not crazy about the category idea in
>>>>>>>>> general because I am one typo away on a late night from getting stuck. If
>>>>>>>>> the code does not compile, that's easier to fix.
>>>>>>>>>
>>>>>>>>
>>>>>>>> I agree on that. It's terribly frustrating to deal with runtime
>>>>>>>> problems that should have been detectable at compile time. Perhaps instead
>>>>>>>> of categories we had a meta-annotation that describes a plugin category,
>>>>>>>> and then plugins can use a category annotation instead of the parameter? We
>>>>>>>> could really use annotations like this to make things more typed with less
>>>>>>>> typing.
>>>>>>>>
>>>>>>>> --
>>>>>>>> Matt Sicker <bo...@gmail.com>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Matt Sicker <bo...@gmail.com>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> 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 <bo...@gmail.com>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> 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 <bo...@gmail.com>
>>>
>>
>>
>>
>> --
>> Matt Sicker <bo...@gmail.com>
>>
>
>
>
> --
> 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 <bo...@gmail.com>

Re: Registering converters

Posted by Gary Gregory <ga...@gmail.com>.
Welcome back Matt then.

Are you putting yourself on deck to redo the type converters a la Log4j?

Gary


On Mon, Jun 2, 2014 at 10:55 PM, Matt Sicker <bo...@gmail.com> wrote:

> Scratch that idea. It's using ASM. That's definitely not worth it.
>
>
> On 2 June 2014 21:51, Matt Sicker <bo...@gmail.com> wrote:
>
>> I'm looking at how Spring does it, and for pre-1.8 code, it's quite the
>> rabbit hole. I'll report back when I find my way out.
>>
>>
>> On 2 June 2014 21:39, Gary Gregory <ga...@gmail.com> wrote:
>>
>>> On Mon, Jun 2, 2014 at 10:35 PM, Matt Sicker <bo...@gmail.com> wrote:
>>>
>>>> Not for the factory/builder stuff! Unless we cached more data about
>>>> plugins like that.
>>>>
>>>
>>> Ah, I made an incorrect assumption then. Let's keep it simple and
>>> require the name then? We can always enhance later.
>>>
>>> Gary
>>>
>>>
>>>>
>>>>
>>>> On 2 June 2014 21:32, Gary Gregory <ga...@gmail.com> wrote:
>>>>
>>>>> It would only happen at compile time... so who cares?
>>>>>
>>>>> Gary
>>>>>
>>>>>
>>>>> On Mon, Jun 2, 2014 at 10:29 PM, Matt Sicker <bo...@gmail.com> wrote:
>>>>>
>>>>>> In regards to the parameter reflection stuff, I can't find anything
>>>>>> in 1.6 other than using
>>>>>> Introspector.getBeanInfo(Class<?>).getMethodDescriptors() and
>>>>>> MethodDescriptor.getParameterDescriptors(). From what I recall,
>>>>>> Introspector is rather slow for this sort of situation and is mostly used
>>>>>> in GUIs that deal with JavaBeans.
>>>>>>
>>>>>>
>>>>>> On 2 June 2014 21:20, Matt Sicker <bo...@gmail.com> wrote:
>>>>>>
>>>>>>> On 2 June 2014 21:14, Gary Gregory <ga...@gmail.com> wrote:
>>>>>>>>
>>>>>>>> Well, my point is that you'd just use an annotation. What the
>>>>>>>> annotation is, I do not know. I'm not crazy about the category idea in
>>>>>>>> general because I am one typo away on a late night from getting stuck. If
>>>>>>>> the code does not compile, that's easier to fix.
>>>>>>>>
>>>>>>>
>>>>>>> I agree on that. It's terribly frustrating to deal with runtime
>>>>>>> problems that should have been detectable at compile time. Perhaps instead
>>>>>>> of categories we had a meta-annotation that describes a plugin category,
>>>>>>> and then plugins can use a category annotation instead of the parameter? We
>>>>>>> could really use annotations like this to make things more typed with less
>>>>>>> typing.
>>>>>>>
>>>>>>> --
>>>>>>> Matt Sicker <bo...@gmail.com>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Matt Sicker <bo...@gmail.com>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> 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 <bo...@gmail.com>
>>>>
>>>
>>>
>>>
>>> --
>>> 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 <bo...@gmail.com>
>>
>
>
>
> --
> Matt Sicker <bo...@gmail.com>
>



-- 
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

Re: Registering converters

Posted by Matt Sicker <bo...@gmail.com>.
Scratch that idea. It's using ASM. That's definitely not worth it.


On 2 June 2014 21:51, Matt Sicker <bo...@gmail.com> wrote:

> I'm looking at how Spring does it, and for pre-1.8 code, it's quite the
> rabbit hole. I'll report back when I find my way out.
>
>
> On 2 June 2014 21:39, Gary Gregory <ga...@gmail.com> wrote:
>
>> On Mon, Jun 2, 2014 at 10:35 PM, Matt Sicker <bo...@gmail.com> wrote:
>>
>>> Not for the factory/builder stuff! Unless we cached more data about
>>> plugins like that.
>>>
>>
>> Ah, I made an incorrect assumption then. Let's keep it simple and require
>> the name then? We can always enhance later.
>>
>> Gary
>>
>>
>>>
>>>
>>> On 2 June 2014 21:32, Gary Gregory <ga...@gmail.com> wrote:
>>>
>>>> It would only happen at compile time... so who cares?
>>>>
>>>> Gary
>>>>
>>>>
>>>> On Mon, Jun 2, 2014 at 10:29 PM, Matt Sicker <bo...@gmail.com> wrote:
>>>>
>>>>> In regards to the parameter reflection stuff, I can't find anything in
>>>>> 1.6 other than using
>>>>> Introspector.getBeanInfo(Class<?>).getMethodDescriptors() and
>>>>> MethodDescriptor.getParameterDescriptors(). From what I recall,
>>>>> Introspector is rather slow for this sort of situation and is mostly used
>>>>> in GUIs that deal with JavaBeans.
>>>>>
>>>>>
>>>>> On 2 June 2014 21:20, Matt Sicker <bo...@gmail.com> wrote:
>>>>>
>>>>>> On 2 June 2014 21:14, Gary Gregory <ga...@gmail.com> wrote:
>>>>>>>
>>>>>>> Well, my point is that you'd just use an annotation. What the
>>>>>>> annotation is, I do not know. I'm not crazy about the category idea in
>>>>>>> general because I am one typo away on a late night from getting stuck. If
>>>>>>> the code does not compile, that's easier to fix.
>>>>>>>
>>>>>>
>>>>>> I agree on that. It's terribly frustrating to deal with runtime
>>>>>> problems that should have been detectable at compile time. Perhaps instead
>>>>>> of categories we had a meta-annotation that describes a plugin category,
>>>>>> and then plugins can use a category annotation instead of the parameter? We
>>>>>> could really use annotations like this to make things more typed with less
>>>>>> typing.
>>>>>>
>>>>>> --
>>>>>> Matt Sicker <bo...@gmail.com>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Matt Sicker <bo...@gmail.com>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> 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 <bo...@gmail.com>
>>>
>>
>>
>>
>> --
>> 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 <bo...@gmail.com>
>



-- 
Matt Sicker <bo...@gmail.com>

Re: Registering converters

Posted by Matt Sicker <bo...@gmail.com>.
I'm looking at how Spring does it, and for pre-1.8 code, it's quite the
rabbit hole. I'll report back when I find my way out.


On 2 June 2014 21:39, Gary Gregory <ga...@gmail.com> wrote:

> On Mon, Jun 2, 2014 at 10:35 PM, Matt Sicker <bo...@gmail.com> wrote:
>
>> Not for the factory/builder stuff! Unless we cached more data about
>> plugins like that.
>>
>
> Ah, I made an incorrect assumption then. Let's keep it simple and require
> the name then? We can always enhance later.
>
> Gary
>
>
>>
>>
>> On 2 June 2014 21:32, Gary Gregory <ga...@gmail.com> wrote:
>>
>>> It would only happen at compile time... so who cares?
>>>
>>> Gary
>>>
>>>
>>> On Mon, Jun 2, 2014 at 10:29 PM, Matt Sicker <bo...@gmail.com> wrote:
>>>
>>>> In regards to the parameter reflection stuff, I can't find anything in
>>>> 1.6 other than using
>>>> Introspector.getBeanInfo(Class<?>).getMethodDescriptors() and
>>>> MethodDescriptor.getParameterDescriptors(). From what I recall,
>>>> Introspector is rather slow for this sort of situation and is mostly used
>>>> in GUIs that deal with JavaBeans.
>>>>
>>>>
>>>> On 2 June 2014 21:20, Matt Sicker <bo...@gmail.com> wrote:
>>>>
>>>>> On 2 June 2014 21:14, Gary Gregory <ga...@gmail.com> wrote:
>>>>>>
>>>>>> Well, my point is that you'd just use an annotation. What the
>>>>>> annotation is, I do not know. I'm not crazy about the category idea in
>>>>>> general because I am one typo away on a late night from getting stuck. If
>>>>>> the code does not compile, that's easier to fix.
>>>>>>
>>>>>
>>>>> I agree on that. It's terribly frustrating to deal with runtime
>>>>> problems that should have been detectable at compile time. Perhaps instead
>>>>> of categories we had a meta-annotation that describes a plugin category,
>>>>> and then plugins can use a category annotation instead of the parameter? We
>>>>> could really use annotations like this to make things more typed with less
>>>>> typing.
>>>>>
>>>>> --
>>>>> Matt Sicker <bo...@gmail.com>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Matt Sicker <bo...@gmail.com>
>>>>
>>>
>>>
>>>
>>> --
>>> 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 <bo...@gmail.com>
>>
>
>
>
> --
> 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 <bo...@gmail.com>

Re: Registering converters

Posted by Gary Gregory <ga...@gmail.com>.
On Mon, Jun 2, 2014 at 10:35 PM, Matt Sicker <bo...@gmail.com> wrote:

> Not for the factory/builder stuff! Unless we cached more data about
> plugins like that.
>

Ah, I made an incorrect assumption then. Let's keep it simple and require
the name then? We can always enhance later.

Gary


>
>
> On 2 June 2014 21:32, Gary Gregory <ga...@gmail.com> wrote:
>
>> It would only happen at compile time... so who cares?
>>
>> Gary
>>
>>
>> On Mon, Jun 2, 2014 at 10:29 PM, Matt Sicker <bo...@gmail.com> wrote:
>>
>>> In regards to the parameter reflection stuff, I can't find anything in
>>> 1.6 other than using
>>> Introspector.getBeanInfo(Class<?>).getMethodDescriptors() and
>>> MethodDescriptor.getParameterDescriptors(). From what I recall,
>>> Introspector is rather slow for this sort of situation and is mostly used
>>> in GUIs that deal with JavaBeans.
>>>
>>>
>>> On 2 June 2014 21:20, Matt Sicker <bo...@gmail.com> wrote:
>>>
>>>> On 2 June 2014 21:14, Gary Gregory <ga...@gmail.com> wrote:
>>>>>
>>>>> Well, my point is that you'd just use an annotation. What the
>>>>> annotation is, I do not know. I'm not crazy about the category idea in
>>>>> general because I am one typo away on a late night from getting stuck. If
>>>>> the code does not compile, that's easier to fix.
>>>>>
>>>>
>>>> I agree on that. It's terribly frustrating to deal with runtime
>>>> problems that should have been detectable at compile time. Perhaps instead
>>>> of categories we had a meta-annotation that describes a plugin category,
>>>> and then plugins can use a category annotation instead of the parameter? We
>>>> could really use annotations like this to make things more typed with less
>>>> typing.
>>>>
>>>> --
>>>> Matt Sicker <bo...@gmail.com>
>>>>
>>>
>>>
>>>
>>> --
>>> Matt Sicker <bo...@gmail.com>
>>>
>>
>>
>>
>> --
>> 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 <bo...@gmail.com>
>



-- 
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

Re: Registering converters

Posted by Matt Sicker <bo...@gmail.com>.
Not for the factory/builder stuff! Unless we cached more data about plugins
like that.


On 2 June 2014 21:32, Gary Gregory <ga...@gmail.com> wrote:

> It would only happen at compile time... so who cares?
>
> Gary
>
>
> On Mon, Jun 2, 2014 at 10:29 PM, Matt Sicker <bo...@gmail.com> wrote:
>
>> In regards to the parameter reflection stuff, I can't find anything in
>> 1.6 other than using
>> Introspector.getBeanInfo(Class<?>).getMethodDescriptors() and
>> MethodDescriptor.getParameterDescriptors(). From what I recall,
>> Introspector is rather slow for this sort of situation and is mostly used
>> in GUIs that deal with JavaBeans.
>>
>>
>> On 2 June 2014 21:20, Matt Sicker <bo...@gmail.com> wrote:
>>
>>> On 2 June 2014 21:14, Gary Gregory <ga...@gmail.com> wrote:
>>>>
>>>> Well, my point is that you'd just use an annotation. What the
>>>> annotation is, I do not know. I'm not crazy about the category idea in
>>>> general because I am one typo away on a late night from getting stuck. If
>>>> the code does not compile, that's easier to fix.
>>>>
>>>
>>> I agree on that. It's terribly frustrating to deal with runtime problems
>>> that should have been detectable at compile time. Perhaps instead of
>>> categories we had a meta-annotation that describes a plugin category, and
>>> then plugins can use a category annotation instead of the parameter? We
>>> could really use annotations like this to make things more typed with less
>>> typing.
>>>
>>> --
>>> Matt Sicker <bo...@gmail.com>
>>>
>>
>>
>>
>> --
>> Matt Sicker <bo...@gmail.com>
>>
>
>
>
> --
> 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 <bo...@gmail.com>

Re: Registering converters

Posted by Gary Gregory <ga...@gmail.com>.
It would only happen at compile time... so who cares?

Gary


On Mon, Jun 2, 2014 at 10:29 PM, Matt Sicker <bo...@gmail.com> wrote:

> In regards to the parameter reflection stuff, I can't find anything in 1.6
> other than using Introspector.getBeanInfo(Class<?>).getMethodDescriptors()
> and MethodDescriptor.getParameterDescriptors(). From what I recall,
> Introspector is rather slow for this sort of situation and is mostly used
> in GUIs that deal with JavaBeans.
>
>
> On 2 June 2014 21:20, Matt Sicker <bo...@gmail.com> wrote:
>
>> On 2 June 2014 21:14, Gary Gregory <ga...@gmail.com> wrote:
>>>
>>> Well, my point is that you'd just use an annotation. What the annotation
>>> is, I do not know. I'm not crazy about the category idea in general because
>>> I am one typo away on a late night from getting stuck. If the code does not
>>> compile, that's easier to fix.
>>>
>>
>> I agree on that. It's terribly frustrating to deal with runtime problems
>> that should have been detectable at compile time. Perhaps instead of
>> categories we had a meta-annotation that describes a plugin category, and
>> then plugins can use a category annotation instead of the parameter? We
>> could really use annotations like this to make things more typed with less
>> typing.
>>
>> --
>> Matt Sicker <bo...@gmail.com>
>>
>
>
>
> --
> Matt Sicker <bo...@gmail.com>
>



-- 
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

Re: Registering converters

Posted by Matt Sicker <bo...@gmail.com>.
In regards to the parameter reflection stuff, I can't find anything in 1.6
other than using Introspector.getBeanInfo(Class<?>).getMethodDescriptors()
and MethodDescriptor.getParameterDescriptors(). From what I recall,
Introspector is rather slow for this sort of situation and is mostly used
in GUIs that deal with JavaBeans.


On 2 June 2014 21:20, Matt Sicker <bo...@gmail.com> wrote:

> On 2 June 2014 21:14, Gary Gregory <ga...@gmail.com> wrote:
>>
>> Well, my point is that you'd just use an annotation. What the annotation
>> is, I do not know. I'm not crazy about the category idea in general because
>> I am one typo away on a late night from getting stuck. If the code does not
>> compile, that's easier to fix.
>>
>
> I agree on that. It's terribly frustrating to deal with runtime problems
> that should have been detectable at compile time. Perhaps instead of
> categories we had a meta-annotation that describes a plugin category, and
> then plugins can use a category annotation instead of the parameter? We
> could really use annotations like this to make things more typed with less
> typing.
>
> --
> Matt Sicker <bo...@gmail.com>
>



-- 
Matt Sicker <bo...@gmail.com>

Re: Registering converters

Posted by Matt Sicker <bo...@gmail.com>.
On 2 June 2014 21:14, Gary Gregory <ga...@gmail.com> wrote:
>
> Well, my point is that you'd just use an annotation. What the annotation
> is, I do not know. I'm not crazy about the category idea in general because
> I am one typo away on a late night from getting stuck. If the code does not
> compile, that's easier to fix.
>

I agree on that. It's terribly frustrating to deal with runtime problems
that should have been detectable at compile time. Perhaps instead of
categories we had a meta-annotation that describes a plugin category, and
then plugins can use a category annotation instead of the parameter? We
could really use annotations like this to make things more typed with less
typing.

-- 
Matt Sicker <bo...@gmail.com>

Re: Registering converters

Posted by Gary Gregory <ga...@gmail.com>.
On Mon, Jun 2, 2014 at 10:08 PM, Matt Sicker <bo...@gmail.com> wrote:

> On 2 June 2014 20:59, Gary Gregory <ga...@gmail.com> wrote:
>
>> If your builder has a triplet of ivar/getter/setter for each factory
>> parameter, then it's more code and more "complicated" than a single factory
>> method with paramters. IMO. YMMV. The problem here is that I do want to be
>> forced into one configuration style but OTOH I do not think it is good for
>> us to provide two or three styles to do the same thing. We need to pick
>> one. It' bad enough we have three different configuration file syntax
>> formats.
>>
>
> The builders have setters only (which return this at the end of each one).
> The fields themselves are used for getting the values. Really, the builders
> are basically auto-generated setters for the most part. I think Groovy has
> an easier way to do this via closures, but that's not really useful for us.
>
> To to follow the rest of Log4j, I could have a class with a bunch static
>> inner classes all annotated with something like @TypeConverter and that
>> would be it?
>>
>
> So scan for a new annotation? Or just re-use @Plugin on the class with a
> category like "TypeConverters" or similar?
>

Well, my point is that you'd just use an annotation. What the annotation
is, I do not know. I'm not crazy about the category idea in general because
I am one typo away on a late night from getting stuck. If the code does not
compile, that's easier to fix.

Gary


>
> --
> Matt Sicker <bo...@gmail.com>
>



-- 
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

Re: Registering converters

Posted by Matt Sicker <bo...@gmail.com>.
On 2 June 2014 20:59, Gary Gregory <ga...@gmail.com> wrote:

> If your builder has a triplet of ivar/getter/setter for each factory
> parameter, then it's more code and more "complicated" than a single factory
> method with paramters. IMO. YMMV. The problem here is that I do want to be
> forced into one configuration style but OTOH I do not think it is good for
> us to provide two or three styles to do the same thing. We need to pick
> one. It' bad enough we have three different configuration file syntax
> formats.
>

The builders have setters only (which return this at the end of each one).
The fields themselves are used for getting the values. Really, the builders
are basically auto-generated setters for the most part. I think Groovy has
an easier way to do this via closures, but that's not really useful for us.

To to follow the rest of Log4j, I could have a class with a bunch static
> inner classes all annotated with something like @TypeConverter and that
> would be it?
>

So scan for a new annotation? Or just re-use @Plugin on the class with a
category like "TypeConverters" or similar?

-- 
Matt Sicker <bo...@gmail.com>

Re: Registering converters

Posted by Gary Gregory <ga...@gmail.com>.
On Mon, Jun 2, 2014 at 9:50 PM, Matt Sicker <bo...@gmail.com> wrote:

> Part of this is to make it easier for other users to write their own
> plugins easily. Another part of this is to reduce code duplication which is
> very tedious and error-prone.
>

I'm all for that.


> I really don't see how a builder class is more complicated than a method
> with the same number of parameters as fields.
>

If your builder has a triplet of ivar/getter/setter for each factory
parameter, then it's more code and more "complicated" than a single factory
method with paramters. IMO. YMMV. The problem here is that I do want to be
forced into one configuration style but OTOH I do not think it is good for
us to provide two or three styles to do the same thing. We need to pick
one. It' bad enough we have three different configuration file syntax
formats.

If Java had named parameters like many other languages, it wouldn't be an
> issue!
>

Map<String, Object>! ;-) Just kidding.


>
> Another short-term issue we've had with this is that I didn't think of
> re-using the existing plugin infrastructure to register the type
> converters. We've already got similar "framework" things in all the other
> types of plugins like string lookups, layouts, patterns, selectors, and the
> logging-specific appenders and filters.
>
> The registries are short term solutions due to my lack of familiarity in
> creating new plugin types. I agree, the registries add needless complexity
> as the plugins provide the only registry necessary in log4j as far as I can
> tell.
>
> Also, I think that the builders can help provide a way to configure log4j
> in a Java DSL. That's a feature I'd like to see in the future. I hate
> learning new configuration file formats all the time. Being able to
> configure via Java or making a bunch of beans in a Spring XML (or Blueprint
> XML in OSGi) is pretty common in larger projects.
>
> Really, what we need is some more iteration of ideas on how to best go
> about doing this in a flexible way that's easy for us to develop and
> maintain, and easy for users to use and extend.
>

To to follow the rest of Log4j, I could have a class with a bunch static
inner classes all annotated with something like @TypeConverter and that
would be it?

Gary

>
>
> On 2 June 2014 17:13, Remko Popma <re...@gmail.com> wrote:
>
>> Does anyone else also have little alarm bells going off when seeing
>> conversations like this?
>>
>> Before you'd accomplish this by simply coding the conversion in the
>> factory method. Duplicate code would be factored out to utility classes
>> like Strings etc and it was all pretty straightforward.
>>
>> Now we have a framework to do the same, with TypeConverters and
>> Registries and Builders and Visitors.
>> The gain is that we get the conversion from String to int "for free".
>> (Except that it is not free, the complexity just moved somewhere else, and
>> arguably became bigger.)
>> Also, the builders allow us to name parameters when construction plugin
>> objects in tests.
>>
>> The trade-off is that we have a whole lot more infrastructure. Not only
>> is this more code and more complex than what we had before, but as with any
>> framework, it makes assumptions on how things are done and in what order,
>> and if you need to do something differently then the framework just gets in
>> your way...
>> So now we need to keep modifying the framework to handle these cases.
>>
>> I need to spend more time looking at the code, I'm basing a lot of this
>> on the impression I have after reviewing the commit emails, but I'm really
>> starting to think that the gains don't justify the drawbacks.
>>
>> Sent from my iPhone
>>
>> On 2014/06/03, at 6:06, Matt Sicker <bo...@gmail.com> wrote:
>>
>> We need to change the type converter registry to use the existing plugin
>> registry/manager. That would make this a lot easier! I'll work on that
>> sometime this week. I've been meaning to get to that (I have a TODO about
>> it somewhere).
>>
>>
>> On 2 June 2014 11:15, Gary Gregory <ga...@gmail.com> wrote:
>>
>>> If I want to register my own type converters with
>>>
>>> org.apache.logging.log4j.core.config.plugins.util.TypeConverters.registerTypeConverter(Class<?>,
>>> TypeConverter<?>)
>>>
>>> when do I call it to make sure the configuration parsing picks up my
>>> additions before it is to late?
>>>
>>> Gary
>>>
>>> --
>>> 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 <bo...@gmail.com>
>>
>>
>
>
> --
> Matt Sicker <bo...@gmail.com>
>



-- 
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

Re: Registering converters

Posted by Matt Sicker <bo...@gmail.com>.
Part of this is to make it easier for other users to write their own
plugins easily. Another part of this is to reduce code duplication which is
very tedious and error-prone. I really don't see how a builder class is
more complicated than a method with the same number of parameters as
fields. If Java had named parameters like many other languages, it wouldn't
be an issue!

Another short-term issue we've had with this is that I didn't think of
re-using the existing plugin infrastructure to register the type
converters. We've already got similar "framework" things in all the other
types of plugins like string lookups, layouts, patterns, selectors, and the
logging-specific appenders and filters.

The registries are short term solutions due to my lack of familiarity in
creating new plugin types. I agree, the registries add needless complexity
as the plugins provide the only registry necessary in log4j as far as I can
tell.

Also, I think that the builders can help provide a way to configure log4j
in a Java DSL. That's a feature I'd like to see in the future. I hate
learning new configuration file formats all the time. Being able to
configure via Java or making a bunch of beans in a Spring XML (or Blueprint
XML in OSGi) is pretty common in larger projects.

Really, what we need is some more iteration of ideas on how to best go
about doing this in a flexible way that's easy for us to develop and
maintain, and easy for users to use and extend.


On 2 June 2014 17:13, Remko Popma <re...@gmail.com> wrote:

> Does anyone else also have little alarm bells going off when seeing
> conversations like this?
>
> Before you'd accomplish this by simply coding the conversion in the
> factory method. Duplicate code would be factored out to utility classes
> like Strings etc and it was all pretty straightforward.
>
> Now we have a framework to do the same, with TypeConverters and Registries
> and Builders and Visitors.
> The gain is that we get the conversion from String to int "for free".
> (Except that it is not free, the complexity just moved somewhere else, and
> arguably became bigger.)
> Also, the builders allow us to name parameters when construction plugin
> objects in tests.
>
> The trade-off is that we have a whole lot more infrastructure. Not only is
> this more code and more complex than what we had before, but as with any
> framework, it makes assumptions on how things are done and in what order,
> and if you need to do something differently then the framework just gets in
> your way...
> So now we need to keep modifying the framework to handle these cases.
>
> I need to spend more time looking at the code, I'm basing a lot of this on
> the impression I have after reviewing the commit emails, but I'm really
> starting to think that the gains don't justify the drawbacks.
>
> Sent from my iPhone
>
> On 2014/06/03, at 6:06, Matt Sicker <bo...@gmail.com> wrote:
>
> We need to change the type converter registry to use the existing plugin
> registry/manager. That would make this a lot easier! I'll work on that
> sometime this week. I've been meaning to get to that (I have a TODO about
> it somewhere).
>
>
> On 2 June 2014 11:15, Gary Gregory <ga...@gmail.com> wrote:
>
>> If I want to register my own type converters with
>>
>> org.apache.logging.log4j.core.config.plugins.util.TypeConverters.registerTypeConverter(Class<?>,
>> TypeConverter<?>)
>>
>> when do I call it to make sure the configuration parsing picks up my
>> additions before it is to late?
>>
>> Gary
>>
>> --
>> 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 <bo...@gmail.com>
>
>


-- 
Matt Sicker <bo...@gmail.com>

Re: Registering converters

Posted by Ralph Goers <rg...@apache.org>.
That was precisely my reaction yesterday. 

Sent from my iPad

> On Jun 2, 2014, at 3:13 PM, Remko Popma <re...@gmail.com> wrote:
> 
> Does anyone else also have little alarm bells going off when seeing conversations like this?
> 
> Before you'd accomplish this by simply coding the conversion in the factory method. Duplicate code would be factored out to utility classes like Strings etc and it was all pretty straightforward. 
> 
> Now we have a framework to do the same, with TypeConverters and Registries and Builders and Visitors. 
> The gain is that we get the conversion from String to int "for free". (Except that it is not free, the complexity just moved somewhere else, and arguably became bigger.)
> Also, the builders allow us to name parameters when construction plugin objects in tests. 
> 
> The trade-off is that we have a whole lot more infrastructure. Not only is this more code and more complex than what we had before, but as with any framework, it makes assumptions on how things are done and in what order, and if you need to do something differently then the framework just gets in your way...
> So now we need to keep modifying the framework to handle these cases. 
> 
> I need to spend more time looking at the code, I'm basing a lot of this on the impression I have after reviewing the commit emails, but I'm really starting to think that the gains don't justify the drawbacks. 
> 
> Sent from my iPhone
> 
>> On 2014/06/03, at 6:06, Matt Sicker <bo...@gmail.com> wrote:
>> 
>> We need to change the type converter registry to use the existing plugin registry/manager. That would make this a lot easier! I'll work on that sometime this week. I've been meaning to get to that (I have a TODO about it somewhere).
>> 
>> 
>>> On 2 June 2014 11:15, Gary Gregory <ga...@gmail.com> wrote:
>>> If I want to register my own type converters with
>>> 
>>> org.apache.logging.log4j.core.config.plugins.util.TypeConverters.registerTypeConverter(Class<?>, TypeConverter<?>)
>>> 
>>> when do I call it to make sure the configuration parsing picks up my additions before it is to late?
>>> 
>>> Gary
>>> 
>>> -- 
>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org 
>>> 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
>> 
>> 
>> 
>> -- 
>> Matt Sicker <bo...@gmail.com>

Re: Registering converters

Posted by Remko Popma <re...@gmail.com>.
Does anyone else also have little alarm bells going off when seeing conversations like this?

Before you'd accomplish this by simply coding the conversion in the factory method. Duplicate code would be factored out to utility classes like Strings etc and it was all pretty straightforward. 

Now we have a framework to do the same, with TypeConverters and Registries and Builders and Visitors. 
The gain is that we get the conversion from String to int "for free". (Except that it is not free, the complexity just moved somewhere else, and arguably became bigger.)
Also, the builders allow us to name parameters when construction plugin objects in tests. 

The trade-off is that we have a whole lot more infrastructure. Not only is this more code and more complex than what we had before, but as with any framework, it makes assumptions on how things are done and in what order, and if you need to do something differently then the framework just gets in your way...
So now we need to keep modifying the framework to handle these cases. 

I need to spend more time looking at the code, I'm basing a lot of this on the impression I have after reviewing the commit emails, but I'm really starting to think that the gains don't justify the drawbacks. 

Sent from my iPhone

> On 2014/06/03, at 6:06, Matt Sicker <bo...@gmail.com> wrote:
> 
> We need to change the type converter registry to use the existing plugin registry/manager. That would make this a lot easier! I'll work on that sometime this week. I've been meaning to get to that (I have a TODO about it somewhere).
> 
> 
>> On 2 June 2014 11:15, Gary Gregory <ga...@gmail.com> wrote:
>> If I want to register my own type converters with
>> 
>> org.apache.logging.log4j.core.config.plugins.util.TypeConverters.registerTypeConverter(Class<?>, TypeConverter<?>)
>> 
>> when do I call it to make sure the configuration parsing picks up my additions before it is to late?
>> 
>> Gary
>> 
>> -- 
>> E-Mail: garydgregory@gmail.com | ggregory@apache.org 
>> 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
> 
> 
> 
> -- 
> Matt Sicker <bo...@gmail.com>

Re: Registering converters

Posted by Matt Sicker <bo...@gmail.com>.
We need to change the type converter registry to use the existing plugin
registry/manager. That would make this a lot easier! I'll work on that
sometime this week. I've been meaning to get to that (I have a TODO about
it somewhere).


On 2 June 2014 11:15, Gary Gregory <ga...@gmail.com> wrote:

> If I want to register my own type converters with
>
> org.apache.logging.log4j.core.config.plugins.util.TypeConverters.registerTypeConverter(Class<?>,
> TypeConverter<?>)
>
> when do I call it to make sure the configuration parsing picks up my
> additions before it is to late?
>
> Gary
>
> --
> 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 <bo...@gmail.com>