Re: @PluginElement for Maps?

2016-09-16 Thread Gary Gregory
On Fri, Sep 16, 2016 at 8:39 PM, Ralph Goers 
wrote:

> Does my answer to your other email make this question moot?
>

Kind of but not really :-) We can pause this thread and continue the more
meaty discussion in the other thread.

Thank you,
Gary

>
> Ralph
>
> On Sep 16, 2016, at 11:55 AM, Gary Gregory  wrote:
>
> Right now, we can say:
>
> @PluginFactory
> public static ConcurrentMap createAppenders(
> @PluginElement("Appenders") final Appender[] appenders) {
>
> and you get an array of type Foo, which is really neat.
>
> What it be out of bounds to think of doing:
>
> @PluginElement("Thing") final Map thingMap
>
> ?
>
> My use case would be:
>
> @PluginFactory
> public static ConcurrentMap createAppenders(
> @PluginElement("Appenders") final Appender[] appenders,
> @PluginElement("Script") final
> Map scriptMap) {
>
>
> What is the key? Good question It could be 1) Thing.getKey() or 2)
> Thing.getName() or whatever method is decorated with a new @PluginKey
> annotation.
>
> Thoughts?
>
> Gary
>
> --
> E-Mail: garydgreg...@gmail.com | ggreg...@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
>
>
>


-- 
E-Mail: garydgreg...@gmail.com | ggreg...@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: @PluginElement for Maps?

2016-09-16 Thread Ralph Goers
Does my answer to your other email make this question moot?

Ralph

> On Sep 16, 2016, at 11:55 AM, Gary Gregory  wrote:
> 
> Right now, we can say:
> 
> @PluginFactory
> public static ConcurrentMap createAppenders(
> @PluginElement("Appenders") final Appender[] appenders) {
> 
> and you get an array of type Foo, which is really neat.
> 
> What it be out of bounds to think of doing:
> 
> @PluginElement("Thing") final Map thingMap
> 
> ?
> 
> My use case would be:
> 
> @PluginFactory
> public static ConcurrentMap createAppenders(
> @PluginElement("Appenders") final Appender[] appenders,
> @PluginElement("Script") final Map scriptMap) 
> {
> 
> 
> What is the key? Good question It could be 1) Thing.getKey() or 2) 
> Thing.getName() or whatever method is decorated with a new @PluginKey 
> annotation.
> 
> Thoughts?
> 
> Gary
> 
> -- 
> E-Mail: garydgreg...@gmail.com  | 
> ggreg...@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: @PluginElement for Maps?

2016-09-16 Thread Matt Sicker
See AbstractConfiguration.createPluginObject() along with createPluginMap().

On 16 September 2016 at 15:11, Matt Sicker  wrote:

> There's some sort of support already for Map and Collection as a
> @PluginElement, though I've never actually used it.
>
> On 16 September 2016 at 13:55, Gary Gregory 
> wrote:
>
>> Right now, we can say:
>>
>> @PluginFactory
>> public static ConcurrentMap createAppenders(
>> @PluginElement("Appenders") final Appender[] appenders) {
>>
>> and you get an array of type Foo, which is really neat.
>>
>> What it be out of bounds to think of doing:
>>
>> @PluginElement("Thing") final Map thingMap
>>
>> ?
>>
>> My use case would be:
>>
>> @PluginFactory
>> public static ConcurrentMap createAppenders(
>> @PluginElement("Appenders") final Appender[] appenders,
>> @PluginElement("Script") final
>> Map scriptMap) {
>>
>>
>> What is the key? Good question It could be 1) Thing.getKey() or 2)
>> Thing.getName() or whatever method is decorated with a new @PluginKey
>> annotation.
>>
>> Thoughts?
>>
>> Gary
>>
>> --
>> E-Mail: garydgreg...@gmail.com | ggreg...@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 
>



-- 
Matt Sicker 


Re: @PluginElement for Maps?

2016-09-16 Thread Matt Sicker
There's some sort of support already for Map and Collection as a
@PluginElement, though I've never actually used it.

On 16 September 2016 at 13:55, Gary Gregory  wrote:

> Right now, we can say:
>
> @PluginFactory
> public static ConcurrentMap createAppenders(
> @PluginElement("Appenders") final Appender[] appenders) {
>
> and you get an array of type Foo, which is really neat.
>
> What it be out of bounds to think of doing:
>
> @PluginElement("Thing") final Map thingMap
>
> ?
>
> My use case would be:
>
> @PluginFactory
> public static ConcurrentMap createAppenders(
> @PluginElement("Appenders") final Appender[] appenders,
> @PluginElement("Script") final
> Map scriptMap) {
>
>
> What is the key? Good question It could be 1) Thing.getKey() or 2)
> Thing.getName() or whatever method is decorated with a new @PluginKey
> annotation.
>
> Thoughts?
>
> Gary
>
> --
> E-Mail: garydgreg...@gmail.com | ggreg...@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