When the Converter specification is released (part of R7) you will be able to
use that quite easily, in fact that will be the recommended way. For example to
convert a map type:
MyAnnotationType config =
converter.convert(map).to(MyAnnotationType.class);
A converter implementation is available as a snapshot from the Felix project.
Regards,
Neil
> On 30 Jan 2017, at 12:37, Konrad Windszus <[email protected]> wrote:
>
> When you use the Component Property Types being introduced with OSGi DS 1.4,
> you need to define those as annotation classes.
>
> For unit tests it is very common, that you need to dynamically generate
> several instances of those annotations (when you want to test calling the
> activate() method with different configurations).
> Are there any good code examples or recommended libraries which ease to do
> that?
>
> I found several responses in
> http://stackoverflow.com/questions/16299717/how-to-create-an-instance-of-an-annotation
> but none of them seem like the perfect match.
> If you could share how you did that in other projects that would be great,
> Konrad
>