felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "james strachan (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FELIX-4392) make @Property use RetentionPolicy.RUNTIME so that code can use runtime field/setter injecting property values
Date Thu, 16 Jan 2014 11:30:19 GMT

    [ https://issues.apache.org/jira/browse/FELIX-4392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13873291#comment-13873291
] 

james strachan commented on FELIX-4392:
---------------------------------------

OK thanks for the heads up! Lets close this then.


> 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)

Mime
View raw message