>But what is the preferred way to get a configuration? I would assume
>that you get a configuration for a key similar to the pid for OSGi
>configurations. From an API point of view a
>
>T[] getConfiguration(String key, Class<T> type);
>
>for a single and
>
>T[] getConfigurations(String key, Class<T> type);
>
>for multiple would do?


proposal how the API can be used:

---
Configuration config = resource.adaptTo(Configuration.class);

// single access
String value = config.get(MyTypedConfig.class).getParam1();

// multiple acces
MyTypedConfig[] myconfigs = config.getMultiple(MyTypedConfig.class);
String value = myconfigs[0].getParam1()
---

i thought about if we can get rid of the Configuration.class at all and 
directly use MyTypedConfig.class or MyTypedConfig[].class in the adaptTo() 
call, but i'm not sure if that’s working with annotation types. or use 
Configuration.class only in cases where you need string-based value map access.

i currently do not see a need for a "key" when accessing the typed 
configuration.

stefan

Reply via email to