See AbstractConfiguration.createPluginObject() along with createPluginMap().

On 16 September 2016 at 15:11, Matt Sicker <boa...@gmail.com> 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 <garydgreg...@gmail.com>
> wrote:
>
>> Right now, we can say:
>>
>>     @PluginFactory
>>     public static ConcurrentMap<String, Appender> 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<String, Thing> thingMap
>>
>> ?
>>
>> My use case would be:
>>
>>     @PluginFactory
>>     public static ConcurrentMap<String, Appender> createAppenders(
>>                 @PluginElement("Appenders") final Appender[] appenders,
>>                 @PluginElement("Script") final
>> Map<String, Script> 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
>> <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>
>



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

Reply via email to