[JBoss JIRA] (CDI-643) Provide a way to easily configure injection point of an InjectionTarget
by Antoine Sabot-Durand (JIRA)
[ https://issues.jboss.org/browse/CDI-643?page=com.atlassian.jira.plugin.sy... ]
Work on CDI-643 started by Antoine Sabot-Durand.
------------------------------------------------
> Provide a way to easily configure injection point of an InjectionTarget
> -----------------------------------------------------------------------
>
> Key: CDI-643
> URL: https://issues.jboss.org/browse/CDI-643
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Reporter: Antoine Sabot-Durand
> Assignee: Antoine Sabot-Durand
> Fix For: 2.0 .Final
>
>
> Creating an {{InjectionTarget}} requires an AnnotatedType. It is often convenient to create a custom {{AnnotatedType}} to add injection points in it (i.e. add {{@Inject}} on fields or methods).
> We Introduced the {{AnnotatedTypeConfigurator}} helper but didn't provide a way to use it to create an {{InjectionTarget}}.
> I think we should add {{BeanManager.createAnnotatedTypeConfigurator()}} to solve this and perhaps simplify other places where we could use an {{AnnotatedTypeConfigurator}} like in CDI-642
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
8 years, 1 month
[JBoss JIRA] (CDI-654) Revisit BeanConfigurator create/destroy methods
by Martin Kouba (JIRA)
Martin Kouba created CDI-654:
--------------------------------
Summary: Revisit BeanConfigurator create/destroy methods
Key: CDI-654
URL: https://issues.jboss.org/browse/CDI-654
Project: CDI Specification Issues
Issue Type: Clarification
Reporter: Martin Kouba
Assignee: Martin Kouba
Fix For: 2.0 .Final
Right now, there are four methods to create/producer bean instance and two methods to destroy/dispose bean instance:
* {{createWith(Function<CreationalContext<U>, U> callback)}}
* {{<U extends T> BeanConfigurator<U> produceWith(Supplier<U> callback)}}
* {{<U extends T> BeanConfigurator<U> produceWith(Function<Instance<Object>, U> callback)}}
* {{<U extends T> BeanConfigurator<U> producing(U instance)}}
* {{destroyWith(BiConsumer<T, CreationalContext<T>> callback)}}
* {{disposeWith(Consumer<T> callback)}}
I think we should:
* remove {{producing()}} and {{produceWith(Supplier<U> callback)}} methods
* clarify that {{Instance<Object>}} is used to "simulate" producer method injection points and behaves in the same way
* modify {{disposeWith(Consumer<T> callback)}} to {{disposeWith(BiConsumer<T, Instance<Object>> callback)}} so that it's possible to "simulate" disposer method injection points
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
8 years, 1 month
[JBoss JIRA] (CDI-653) Introduce BeanManager#getInstances() to ease instance resolution in custom SPI
by Antoine Sabot-Durand (JIRA)
[ https://issues.jboss.org/browse/CDI-653?page=com.atlassian.jira.plugin.sy... ]
Antoine Sabot-Durand commented on CDI-653:
------------------------------------------
[~ljnelson] on the paper yes, but {{CDI.current()}} is static that can cause problems in certain use cases. But the idea is to provide the same comfort in a cleaner way.
> Introduce BeanManager#getInstances() to ease instance resolution in custom SPI
> ------------------------------------------------------------------------------
>
> Key: CDI-653
> URL: https://issues.jboss.org/browse/CDI-653
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Reporter: Antoine Sabot-Durand
> Fix For: 2.1 (Discussion)
>
>
> Right now if you need a bean instance in one of your extension or custom SPI (i.e. instance of Bean A is needed to create Bean B) you have to write something like
> {code:java}
> Set<Bean<?>> beanSet = beanManager.getBeans(MyClass.class);
> Bean<?> bean = beanManager.resolve(beanSet);
> MyClass instance = (MyClass) beanManager.getReference(bean, MyClass.class, beanManager.createCreationalContext(bean));
> {code}
> While it can be useful to get thru all this step of type safe resolution, a typical use case is: I need this contextual instance (or these contextual instances) to do conditional action according to its state.
> So providing a Bean Manager method returning an {{Instance<Object>}} could be a short cut that could help a lot of advanced developers:
> {code:java}
> beanManager.getInstances().select(MyClass.class).get();
> {code}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
8 years, 1 month
[JBoss JIRA] (CDI-653) Introduce BeanManager#getInstances() to ease instance resolution in custom SPI
by Martin Kouba (JIRA)
[ https://issues.jboss.org/browse/CDI-653?page=com.atlassian.jira.plugin.sy... ]
Martin Kouba commented on CDI-653:
----------------------------------
We should also define what happens if a {{@Dependent}} bean is created, e.g. the user is responsible for the destruction, otherwise memory leaks may occur.
> Introduce BeanManager#getInstances() to ease instance resolution in custom SPI
> ------------------------------------------------------------------------------
>
> Key: CDI-653
> URL: https://issues.jboss.org/browse/CDI-653
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Reporter: Antoine Sabot-Durand
> Fix For: 2.1 (Discussion)
>
>
> Right now if you need a bean instance in one of your extension or custom SPI (i.e. instance of Bean A is needed to create Bean B) you have to write something like
> {code:java}
> Set<Bean<?>> beanSet = beanManager.getBeans(MyClass.class);
> Bean<?> bean = beanManager.resolve(beanSet);
> MyClass instance = (MyClass) beanManager.getReference(bean, MyClass.class, beanManager.createCreationalContext(bean));
> {code}
> While it can be useful to get thru all this step of type safe resolution, a typical use case is: I need this contextual instance (or these contextual instances) to do conditional action according to its state.
> So providing a Bean Manager method returning an {{Instance<Object>}} could be a short cut that could help a lot of advanced developers:
> {code:java}
> beanManager.getInstances().select(MyClass.class).get();
> {code}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
8 years, 1 month
[JBoss JIRA] (CDI-653) Introduce BeanManager#getInstances() to ease instance resolution in custom SPI
by Antonin Stefanutti (JIRA)
[ https://issues.jboss.org/browse/CDI-653?page=com.atlassian.jira.plugin.sy... ]
Antonin Stefanutti commented on CDI-653:
----------------------------------------
+1
> Introduce BeanManager#getInstances() to ease instance resolution in custom SPI
> ------------------------------------------------------------------------------
>
> Key: CDI-653
> URL: https://issues.jboss.org/browse/CDI-653
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Reporter: Antoine Sabot-Durand
> Fix For: 2.1 (Discussion)
>
>
> Right now if you need a bean instance in one of your extension or custom SPI (i.e. instance of Bean A is needed to create Bean B) you have to write something like
> {code:java}
> Set<Bean<?>> beanSet = beanManager.getBeans(MyClass.class);
> Bean<?> bean = beanManager.resolve(beanSet);
> MyClass instance = (MyClass) beanManager.getReference(bean, MyClass.class, beanManager.createCreationalContext(bean));
> {code}
> While it can be useful to get thru all this step of type safe resolution, a typical use case is: I need this contextual instance (or these contextual instances) to do conditional action according to its state.
> So providing a Bean Manager method returning an {{Instance<Object>}} could be a short cut that could help a lot of advanced developers:
> {code:java}
> beanManager.getInstances().select(MyClass.class).get();
> {code}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
8 years, 1 month
[JBoss JIRA] (CDI-653) Introduce BeanManager#getInstances() to ease instance resolution in custom SPI
by Laird Nelson (JIRA)
[ https://issues.jboss.org/browse/CDI-653?page=com.atlassian.jira.plugin.sy... ]
Laird Nelson commented on CDI-653:
----------------------------------
Possibly ignorant question: doesn't {{CDI.current().select(MyClass.class).get()}} do this already?
> Introduce BeanManager#getInstances() to ease instance resolution in custom SPI
> ------------------------------------------------------------------------------
>
> Key: CDI-653
> URL: https://issues.jboss.org/browse/CDI-653
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Reporter: Antoine Sabot-Durand
> Fix For: 2.1 (Discussion)
>
>
> Right now if you need a bean instance in one of your extension or custom SPI (i.e. instance of Bean A is needed to create Bean B) you have to write something like
> {code:java}
> Set<Bean<?>> beanSet = beanManager.getBeans(MyClass.class);
> Bean<?> bean = beanManager.resolve(beanSet);
> MyClass instance = (MyClass) beanManager.getReference(bean, MyClass.class, beanManager.createCreationalContext(bean));
> {code}
> While it can be useful to get thru all this step of type safe resolution, a typical use case is: I need this contextual instance (or these contextual instances) to do conditional action according to its state.
> So providing a Bean Manager method returning an {{Instance<Object>}} could be a short cut that could help a lot of advanced developers:
> {code:java}
> beanManager.getInstances().select(MyClass.class).get();
> {code}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
8 years, 1 month
[JBoss JIRA] (CDI-653) Introduce BeanManager#getInstances() to ease instance resolution in custom SPI
by Emily Jiang (JIRA)
[ https://issues.jboss.org/browse/CDI-653?page=com.atlassian.jira.plugin.sy... ]
Emily Jiang commented on CDI-653:
---------------------------------
+1
> Introduce BeanManager#getInstances() to ease instance resolution in custom SPI
> ------------------------------------------------------------------------------
>
> Key: CDI-653
> URL: https://issues.jboss.org/browse/CDI-653
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Reporter: Antoine Sabot-Durand
> Fix For: 2.1 (Discussion)
>
>
> Right now if you need a bean instance in one of your extension or custom SPI (i.e. instance of Bean A is needed to create Bean B) you have to write something like
> {code:java}
> Set<Bean<?>> beanSet = beanManager.getBeans(MyClass.class);
> Bean<?> bean = beanManager.resolve(beanSet);
> MyClass instance = (MyClass) beanManager.getReference(bean, MyClass.class, beanManager.createCreationalContext(bean));
> {code}
> While it can be useful to get thru all this step of type safe resolution, a typical use case is: I need this contextual instance (or these contextual instances) to do conditional action according to its state.
> So providing a Bean Manager method returning an {{Instance<Object>}} could be a short cut that could help a lot of advanced developers:
> {code:java}
> beanManager.getInstances().select(MyClass.class).get();
> {code}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
8 years, 1 month
[JBoss JIRA] (CDI-653) Introduce BeanManager#getInstances() to ease instance resolution in custom SPI
by Antoine Sabot-Durand (JIRA)
[ https://issues.jboss.org/browse/CDI-653?page=com.atlassian.jira.plugin.sy... ]
Antoine Sabot-Durand updated CDI-653:
-------------------------------------
Fix Version/s: 2.1 (Discussion)
> Introduce BeanManager#getInstances() to ease instance resolution in custom SPI
> ------------------------------------------------------------------------------
>
> Key: CDI-653
> URL: https://issues.jboss.org/browse/CDI-653
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Reporter: Antoine Sabot-Durand
> Fix For: 2.1 (Discussion)
>
>
> Right now if you need a bean instance in one of your extension or custom SPI (i.e. instance of Bean A is needed to create Bean B) you have to write something like
> {code:java}
> Set<Bean<?>> beanSet = beanManager.getBeans(MyClass.class);
> Bean<?> bean = beanManager.resolve(beanSet);
> MyClass instance = (MyClass) beanManager.getReference(bean, MyClass.class, beanManager.createCreationalContext(bean));
> {code}
> While it can be useful to get thru all this step of type safe resolution, a typical use case is: I need this contextual instance (or these contextual instances) to do conditional action according to its state.
> So providing a Bean Manager method returning an {{Instance<Object>}} could be a short cut that could help a lot of advanced developers:
> {code:java}
> beanManager.getInstances().select(MyClass.class).get();
> {code}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
8 years, 1 month
[JBoss JIRA] (CDI-653) Introduce BeanManager#getInstances() to ease instance resolution in custom SPI
by Antoine Sabot-Durand (JIRA)
Antoine Sabot-Durand created CDI-653:
----------------------------------------
Summary: Introduce BeanManager#getInstances() to ease instance resolution in custom SPI
Key: CDI-653
URL: https://issues.jboss.org/browse/CDI-653
Project: CDI Specification Issues
Issue Type: Feature Request
Reporter: Antoine Sabot-Durand
Right now if you need a bean instance in one of your extension or custom SPI (i.e. instance of Bean A is needed to create Bean B) you have to write something like
{code:java}
Set<Bean<?>> beanSet = beanManager.getBeans(MyClass.class);
Bean<?> bean = beanManager.resolve(beanSet);
MyClass instance = (MyClass) beanManager.getReference(bean, MyClass.class, beanManager.createCreationalContext(bean));
{code}
While it can be useful to get thru all this step of type safe resolution, a typical use case is: I need this contextual instance (or these contextual instances) to do conditional action according to its state.
So providing a Bean Manager method returning an {{Instance<Object>}} could be a short cut that could help a lot of advanced developers:
{code:java}
beanManager.getInstances().select(MyClass.class).get();
{code}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
8 years, 1 month