[cdi-dev] BeanConfigurator and ProducerConfigurator consistency
Martin Kouba
mkouba at redhat.com
Wed Dec 28 06:04:52 EST 2016
Dne 23.12.2016 v 11:30 Antonin Stefanutti napsal(a):
> Hi all,
>
> Is there any reason I’m missing it is possible to get an Instance in BeanConfigurator produceWith (resp. disposeWith) while it’s not in ProducerConfigurator produceWith (resp. disposeWith)?
>
> BeanConfigurator:
>
> <U extends T> BeanConfigurator<U> produceWith(Function<Instance<Object>, U> callback);
> BeanConfigurator<T> disposeWith(BiConsumer<T, Instance<Object>> callback);
>
> ProducerConfigurator:
>
> <U extends T> ProducerConfigurator<T> produceWith(Function<CreationalContext<U>, U> callback);
> ProducerConfigurator<T> disposeWith(Consumer<T> callback);
>
> Besides, wouldn’t that be more concise in most use cases to provide the equivalent without the Instance parameter in BeanConfigurator (as it was before CDI 2.0.Beta1)?
There is BeanConfigurator.createWith() which corresponds to
Contextual.create().
BeanConfigurator.produceWith() is a convenient method which might be
used to simulate producer method with parameter injection.
ProducerConfigurator.produceWith() is an equivalent of
Producer.produce(). We might add other convenient methods in CDI 2.1.
>
> Thanks,
> Antonin
>
> _______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev
>
> 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.
>
--
Martin Kouba
Software Engineer
Red Hat, Czech Republic
More information about the cdi-dev
mailing list