Skip to content
This repository has been archived by the owner on Nov 16, 2021. It is now read-only.

DS 1.4 Component Property Types: Allow meta annotations or static fields for generating constant component properties #45

Open
bjhargrave opened this issue Mar 13, 2020 · 3 comments
Labels
publiccomment Public comment

Comments

@bjhargrave
Copy link
Member

Original bug ID: BZ#250
From: Konrad Windszus <[email protected]>
Reported version: R7

@bjhargrave
Copy link
Member Author

Comment author: Konrad Windszus <[email protected]>

Sometimes it is desirable to use an annotation where a specific property is always supposed to have a specific value (i.e. is constant). Although it is possible to define that property via an annotation method with a default value, that way it could be overwritten by the user (which is not intended here).

To prevent that one could either allow component property annotations to be used as met a annotations or also interpret other static fields (apart from the already defined PREFIX) to end up as constant properties in the generated component descriptor.

For a concrete use case look at apache/sling-org-apache-sling-servlets-annotations#3.

@bjhargrave
Copy link
Member Author

Comment author: Bertrand Delacretaz <[email protected]>

I think this matches the behavior described in https://blog.osgi.org/2018/03/osgi-r7-highlights-declarative-services.html which says, in the "ComponentPropertyType" section:

For a marker annotation, a component property name is derived
from the component property type name, just as for single-element
annotations, and the component property value is Boolean.TRUE.
Marker annotations are only useful for setting a component property
to the value true.

@bjhargrave
Copy link
Member Author

Comment author: Konrad Windszus <[email protected]>

IMHO marker annotations are different i.e. they are just annotations without any methods. That wouldn't help here, as those only generate one single property. In our case we are interested to generate multiple properties out of a single annotation, where multiple dimensions should be dynamic and other should be static!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
publiccomment Public comment
Projects
None yet
Development

No branches or pull requests

1 participant