You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "james strachan (JIRA)" <ji...@apache.org> on 2014/01/16 12:30:20 UTC
[jira] [Resolved] (FELIX-4392) make @Property use
RetentionPolicy.RUNTIME so that code can use runtime field/setter injecting
property values
[ https://issues.apache.org/jira/browse/FELIX-4392?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
james strachan resolved FELIX-4392.
-----------------------------------
Resolution: Won't Fix
> 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)