[cdi-dev] Accepting class type for simple (qualifier) annotations in APIs?
arjan.tijms at gmail.com
Mon Sep 12 08:14:52 EDT 2016
Annotation builder would be +1. It's a tiny bit less convenient, but more
universal. So better for the spec.
Convenience addition could theoretically still be:
Set<Bean<?>> getBeans(Type beanType, Class<?> annotationType, Object...
But... I acknowledge that this would again be for a more specific
situation (namely, a bean with exactly 1 qualifier and 0 or more binding
While on the subject, it's currently not possible for an injected bean to
get hold of the annotation instance that's used in CDI.current().select(),
BeanManager.getBeans, etc, is it?
On Mon, Sep 12, 2016 at 1:44 PM, Martin Kouba <mkouba at redhat.com> wrote:
> Type safety is not guaranteed in the current version of
> AnnotationInstanceProvider (deltaspike). We should at least check the
> provided map of member values against the set of declared methods.
> Otherwise, I like the idea of standardizing a similar "annotation instance
> Dne 12.9.2016 v 12:34 Romain Manni-Bucau napsal(a):
>> Think it is maybe saner to have AnnotationProvider.of(type, params)
>> (like in deltaspike) since it doesnt leave the parameterized annotations
>> (which are not rare) next the road.
>> Romain Manni-Bucau
>> @rmannibucau <https://twitter.com/rmannibucau> | Blog
>> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
>> <http://rmannibucau.wordpress.com> | Github
>> <https://github.com/rmannibucau> | LinkedIn
>> <https://www.linkedin.com/in/rmannibucau> | Tomitriber
>> <http://www.tomitribe.com> | JavaEE Factory
>> 2016-09-12 12:28 GMT+02:00 arjan tijms <arjan.tijms at gmail.com
>> <mailto:arjan.tijms at gmail.com>>:
>> 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
>> Kind regards,
>> Arjan Tijms
>> cdi-dev mailing list
>> cdi-dev at lists.jboss.org <mailto: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.
>> 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/license
>> s/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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cdi-dev