The attribute policyOption is undefined for the annotation type Reference | Community
Skip to main content
New Participant
August 21, 2018
Solved

The attribute policyOption is undefined for the annotation type Reference

  • August 21, 2018
  • 12 replies
  • 4263 views

Hi

can anyone help on this below issue,

We are replacing felix annotations with OSGI DS annotations. We have come across with a challenge please find below

Felix annotation :

  @Reference(policyOption = ReferencePolicyOption.GREEDY)

  protected UserConnector userConnector;

 

OSGI Annotation I tried :

  protected UserConnector userConnector;

 

  @Reference(policyOption = ReferencePolicyOption.GREEDY)

  public void bindUserConnector(UserConnector userConnector) {

    this.userConnector = userConnector;

  }

  public void unbindUserConnector(UserConnector userConnector) {

    this.userConnector = userConnector;

  }

 

But there is an error in eclipse where “The attribute policyOption is undefined for the annotation type Reference”.

Can you please tell me whether policyOption is deprecated in OSGi annotations.

Please let me know how to use policyOption = ReferencePolicyOption.Greedy in @Reference OSGI annotation.

Much Appreciated in advance.

Arun Patidar

Feike Visser

smacdonald2008

Thanks

Vijay

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

12 replies

arunpatidar
arunpatidarAccepted solution
New Participant
August 21, 2018
smacdonald2008
New Participant
August 21, 2018

The syntax is not a 1-1 match between felix and DS annotations.

Here is the reference for a DS annotation that will help...

https://osgi.org/javadoc/r4v43/cmpn/org/osgi/service/component/annotations/Reference.html

You can see the applicable values for policyOption.

Hope this helps...