Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qualifiers with Members #8

Open
hendryluk opened this issue Feb 8, 2015 · 0 comments
Open

Qualifiers with Members #8

hendryluk opened this issue Feb 8, 2015 · 0 comments

Comments

@hendryluk
Copy link
Owner

Currently when resolving components, Cormo matches qualifiers using only their types.
According to CDI spec however, attribute properties can be used to further discriminate a qualifier, which helps reducing the number of qualifiers needed. Ref: http://docs.jboss.org/weld/reference/latest/en-US/html/injection.html#_qualifiers_with_members

E.g.

public class PayByAttribute: QualifierAttribute
{
   public PaymentType PaymentType {get; set;}
}

Then we select one of the possible property values when applying the qualifier:

[Inject, PayBy(PaymentType.Check)] PaymentProcessor _checkPayment;

We can force the container to ignore a member of a qualifier type by annotating the property with [Nonbinding] attribute.

public class PayByAttribute: QualifierAttribute
{
   public PaymentType PaymentType {get; set;}
   [NonBinding] string Comment {get; set;}
}

The same should also be applied on interceptor bindings and mixin-bindings.
https://docs.jboss.org/weld/reference/1.0.0/en-US/html/interceptors.html#d0e3527

E.g.

[Transactional(RequiresNew=false)]
public class RequiresNewTransactionInterceptor: IAroundInvokeInterceptor
{
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant