[
https://issues.apache.org/jira/browse/FELIX-4392?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Carsten Ziegeler closed FELIX-4392.
-----------------------------------
Great, thanks
> make @Property use RetentionPolicy.RUNTIME so that code can use runtime
> field/setter injecting property values
> --------------------------------------------------------------------------------------------------------------
>
> Key: FELIX-4392
> URL: https://issues.apache.org/jira/browse/FELIX-4392
> Project: Felix
> Issue Type: Improvement
> Components: SCR Annotations
> Reporter: james strachan
>
> It'd be nice to be able to write a base class for a @Component with an
> @Activate method taking the Map<String,Object> of configurations and
> performing field or setter injection of configurations via @Property - but
> the annotation is not retained at runtime right now due to CLASS not RUNTIME
> RetentionPolicy on @Property.
> Any idea why not? Was this on purpose or just an oversight?
> e.g. it'd be nice to be able to code components like this (and get the SCR
> and MetaType metadata auto-generated)
> {code}
> public abstract class MyAbstractComponent {
> @Activate
> public void activate(Map<String, ?> configuration) throws Exception {
> // use introspection to find the fields and setters with @Property
> annotated...
> }
> }
> ...
> @Component(name = "foo")
> public FooComponent extends MyAbstractComponent {
> @Property
> private int foo;
> @Property
> private String bar;
> ....
> {code}
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)