[cdi-dev] Accepting class type for simple (qualifier) annotations in APIs?
antoine at sabot-durand.net
Thu Sep 15 04:15:04 EDT 2016
Just a naive remark regarding Instance of annotations without members. I already used a lambda to have such an instance:
BeanManager.getBeans(MyBean.class, () -> MyQualifier.class)
I’m not sure there are no problem by using this short cut, but it is quite convenient.
> Le 12 sept. 2016 à 12:28, arjan tijms <arjan.tijms at gmail.com> a écrit :
> Wouldn't it be convenient as the CDI API that now requires an Annotation instance in various APIs, would also accept the class type of that Annotation?
> E.g. in BeanManager there's this method:
> Set<Bean<?>> getBeans(Type beanType, Annotation... qualifiers)
> This not rarely requires one to create an AnnotationLiteral, which is not specifically difficult but a tad verbose. For qualifiers that have no (binding) attributes, a simple Class would be much easier to use.
> Kind regards,
> Arjan Tijms
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.
More information about the cdi-dev