Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cu-dev] [EXTERNAL] Qualifiers in *Definition annotations
  • From: Nathan Rauh <nathan.rauh@xxxxxxxxxx>
  • Date: Mon, 15 Apr 2024 12:26:36 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=us.ibm.com; dmarc=pass action=none header.from=us.ibm.com; dkim=pass header.d=us.ibm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JoUuW2CXlvWwmlAoC84nnR4O10oPz1tYFPRL2vz0UME=; b=XUj2cTwF/Pal/5Z/8nGWroIS8X7G7qvK5EB5rM7ljwzgcXiAag6Fdy/urjOo6eu/FFj/ggurpQuuwfFp/ThWtcAekmC+icdQjuw2jMdNcTffXzudUTaHEatfEHTAOCag7DNAjcb/VUf/lPgfp1TOcr8pfSJC8tt1L+M/h8WWF3dAGs7HZHlli5WHMhid6S7B20Mh4faxFMnLx9C6itlAuX2a3TtuW2tDzhTrSN2+M2uvdYCKly44tmU+8bAr39sqOd4khiEX66Q2bYaVuBaBbvNMLJgcYgtlyayztvcdLdeXvZB5d3aNcUjgBfXpFv6qkGl033W8p/PKehGkyY31eA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KpA0HdC/j3dnKG3XJRb2bKjl8r5qpr7QiywZVUrB5Rfo7L59OxK/5gCLJNFHXo2/VVPxFw505NmvUdsFi+CDVWqUmy+KfPk1eoKRs66D4fPWimhZ7ECYe8vRc6rtA5UYsp16KMSVngrMn3PI5YMK6iDupwUkLeeuZeGxOxD/vQbXTUonzzXSpx2e3blzK2Fa5bmMenObSLcILwCyIrAg+yuspwYI/ZsVabQI8E92X1BmIlmw1gcadfQj4ED3vLlxgkOXqYk8Oh/qZi0fCohyK+aMLEFF0sXY49hHlMpCgyNJCK7EmT7f9ucJO+netnckYKn3oGedjLGPm4AwNMz0cw==
  • Delivered-to: cu-dev@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/cu-dev/>
  • List-help: <mailto:cu-dev-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/cu-dev>, <mailto:cu-dev-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/cu-dev>, <mailto:cu-dev-request@eclipse.org?subject=unsubscribe>
  • Thread-index: AQHajdhPDyfFbyj0gkGH5eoIAZACMbFpQP6J
  • Thread-topic: [EXTERNAL] [cu-dev] Qualifiers in *Definition annotations

Petr,

 

The qualifiers attribute is named with an ‘s’ at the end, suggesting plural, and JavaDoc states that the value is a list of qualifiers, so it does cover allowing multiple qualifiers to be defined as in your example,

 

@ContextServiceDefinition(name = "java:app/ContextBC", qualifiers = {MyContextQualifierB.class, MyContextQualifierC.class})

 

Given that you are also showing the following not commented out,

    @Inject
    @MyContextQualifierA
    ContextService csA;

I assume you also have something like this,

@ContextServiceDefinition(name = "java:app/ContextA", qualifiers = MyContextQualifierA.class)

 

Regarding your commented out examples,

 

This one looks okay because you have a ContextServiceDefinition with MyContextQualifierB

//    @Inject
//    @MyContextQualifierB
//    ContextService csB;

 

This one will not work because it would require both A and B on the same ContextServiceDefinition, which you do not have, or if you did try to add a ContextServiceDefinition with that, it would be in conflict with the others that already have A or B.

//    @Inject
//    @MyContextQualifierA
//    @MyContextQualifierB
//    ContextService csAB;

 

The following does not work either for the same reason.

//    @Inject
//    @MyContextQualifierA
//    @MyContextQualifierB
//    @MyContextQualifierC
//    ContextService csABC;

 

It should be noted that all of the examples that do not work could be made to work by getting rid of the other conflicting ContextServiceDefinitions, but then that would cause some of your non-commented out examples to become invalid.

 

 

From: cu-dev <cu-dev-bounces@xxxxxxxxxxx> on behalf of Petr Aubrecht via cu-dev <cu-dev@xxxxxxxxxxx>
Date: Saturday, April 13, 2024 at 2:25
PM
To: cu developer discussions <cu-dev@xxxxxxxxxxx>
Cc: Petr Aubrecht <aubrecht@xxxxxxxxxxxx>
Subject: [EXTERNAL] [cu-dev] Qualifiers in *Definition annotations

Hello all, I have a dumb question. I'm working on the *Definition annotations and CDI integration (the qualifiers thing). And the question is about combinations of qualifiers. It is not mentioned in javadoc and TCK doesn't test it. Should the

ZjQcmQRYFpfptBannerStart

This Message Is From an External Sender

This message came from outside your organization.

 

ZjQcmQRYFpfptBannerEnd

Hello all,

I have a dumb question. I'm working on the *Definition annotations and CDI integration (the qualifiers thing).

And the question is about combinations of qualifiers. It is not mentioned in javadoc and TCK doesn't test it. Should the commented out examples work as well?

    @Inject
    ContextService csDefault;

    @Inject
    @MyContextQualifierA
    ContextService csA;

//    @Inject
//    @MyContextQualifierB
//    ContextService csB;

//    @Inject
//    @MyContextQualifierA
//    @MyContextQualifierB
//    ContextService csAB;

    @Inject
    @MyContextQualifierB
    @MyContextQualifierC
    ContextService csBC;

//    @Inject
//    @MyContextQualifierA
//    @MyContextQualifierB
//    @MyContextQualifierC
//    ContextService csABC;

 

MyContextQualifier* are qualifiers. Their corresponding definitions look like

@ContextServiceDefinition(name = "java:app/ContextBC", qualifiers = {MyContextQualifierB.class, MyContextQualifierC.class})

 

Thank you for clarification.

Petr

 

 


Back to the top