[cdi-dev] [JBoss JIRA] (CDI-558) Standardize the Meta-Data builders API (BeanBuilder, etc...)

Antoine Sabot-Durand (JIRA) issues at jboss.org
Tue Nov 24 03:31:00 EST 2015


    [ https://issues.jboss.org/browse/CDI-558?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13132991#comment-13132991 ] 

Antoine Sabot-Durand edited comment on CDI-558 at 11/24/15 3:30 AM:
--------------------------------------------------------------------

One use case would be : in Java SE I want to prepare an AnnotatedType to give it as on of the type to discover during container initialization. That's why it can be useful to have a way to create such an AnnotatedType before the container  and  BeanManager availability. So the built-in bean is not a good idea IMO.

If  we agree on that I see several solution

# Put the class in the spec (I don't like it unless we don't find a better solution)
# Use Java service loader like we already do with CDIProvider. The loaded service should be a factory allowing getting an instance for AnnotatedTypeBuilder (yeah a factory of builder). That let us the possibility to add another helpers in it later. 
# Same as previous but with a classical implementation lookup in classpath. The difference is that service loader is guarantee to still work with java 9

Any other thoughts ?


was (Author: antoinesabot-durand):
One use case would be : in Java SE I want to prepare an AnnotatedType to give it as on of the type to discover during container initialization. That's why it can be useful to have a way to create such an AnnotatedType before the container  and  BeanManager availability. So the built-in bean is not a good idea IMO.

If  we agree on that I see several solution

#. Put the class in the spec (I don't like it unless we don't find a better solution)
#. Use Java service loader like we already do with CDIProvider. The loaded service should be a factory allowing getting an instance for AnnotatedTypeBuilder (yeah a factory of builder). That let us the possibility to add another helpers in it later. 
#. Same as previous but with a classical implementation lookup in classpath. The difference is that service loader is guarantee to still work with java 9

Any other thoughts ?

> Standardize the Meta-Data builders API (BeanBuilder, etc...)
> ------------------------------------------------------------
>
>                 Key: CDI-558
>                 URL: https://issues.jboss.org/browse/CDI-558
>             Project: CDI Specification Issues
>          Issue Type: Feature Request
>            Reporter: Martin Kouba
>             Fix For: 2.0 (discussion)
>
>
> The RI includes an experimental BeanBuilder API (see also http://weld.cdi-spec.org/news/2015/02/25/weld-300Alpha5/#_bean_builder_api for more information). The API is similar to the [API provided by DeltaSpike|http://deltaspike.apache.org/javadoc/1.2.1/org/apache/deltaspike/core/util/bean/BeanBuilder.html] but also includes some improvements (e.g. Java 8 lambdas may be used to simplify the process of registration).
> * BeanBuilder Javadoc: http://docs.jboss.org/weld/javadoc/3.0/weld-api/org/jboss/weld/experimental/BeanBuilder.html
> * ExperimentalAfterBeanDiscovery Javadoc: http://docs.jboss.org/weld/javadoc/3.0/weld-api/org/jboss/weld/experimental/ExperimentalAfterBeanDiscovery.html
> * See also [the test extension for more examples of using this API|https://github.com/weld/core/blob/master/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/custombeans/BuilderExtension.java]



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the cdi-dev mailing list