[cdi-dev] [JBoss JIRA] (CDI-614) Review all read methods at configurators

Matej Novotny (JIRA) issues at jboss.org
Tue Jun 7 07:32:00 EDT 2016


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

Matej Novotny commented on CDI-614:
-----------------------------------

bq. all those injection point-related methods on {{BeanConfigurator}} are disputable as well
+1 for that. I mentioned it somewhere already; you can set an injection point with {{BeanConfigurator}} but you cannot achieve the injection itself.

And to share my opinion on read methods:
As for {{read}} methods on {{BeanConfigurator}}, I would say those are fine. Are won't bounce into ClassCastException there and it might prove handy to read a bean you already have and with that basis you build a new one.

Furthermore, amongst {{ObserverMethodConfigurator#read*}} I really dislike {{read(javax.enterprise.inject.spi.ObserverMethod<T>)}}. +1 for removing this. Others can still be used IMHO as they are not susceptible to ClassCastExceptions and easy to use.

Last but not least {{InjectionPointConfigurator#read}}. Those seems pretty useless. I understand read methods when you need to create something from the scratch, but when you are simply adjusting it, it doesn't make much sense.

> Review all read methods at configurators
> ----------------------------------------
>
>                 Key: CDI-614
>                 URL: https://issues.jboss.org/browse/CDI-614
>             Project: CDI Specification Issues
>          Issue Type: Clarification
>    Affects Versions: 2.0-EDR2
>            Reporter: Tomas Remes
>
> Currently there are several read methods used to initialize given configurator. These methods are at:
> * {{BeanConfigurator}}
> * {{InjectionPointConfigurator}}
> * {{ObserverMethodConfigurator}}
> I think we should review all of them. I don't understand to usage or let say additional value of the following ones:
> * {{ObserverMethodConfigurator#read(javax.enterprise.inject.spi.ObserverMethod<T>)}}
> This allows you to add new observer method based on exsiting one. Although when you want to define some observed type (of this new method) you need to specify subtype of the original type or you will end up with ClassCastException.
> Then there are those at {{InjectionPointConfigurator}} which appears to me completely useless:
> * {{InjectionPointConfigurator#read(java.lang.reflect.Field)}}
> * {{InjectionPointConfigurator#read(java.lang.reflect.Parameter)}}
> * {{InjectionPointConfigurator#read(javax.enterprise.inject.spi.AnnotatedField<?>)}}
> * {{InjectionPointConfigurator#read(javax.enterprise.inject.spi.AnnotatedParameter<?>)}}
> * {{InjectionPointConfigurator#read(javax.enterprise.inject.spi.InjectionPoint)}}
> AFAIK the {{InjectionPointConfigurator}} is available only during {{ProcessInjectionPoint}} lifecycle event. My question is why should I use any of these during this lifecycle event since I can easily call {{event.configureInjectionPoint()}}? Do we want to allow to configure different injection point in non corresponding {{ProcessInjectionPoint}} lifecycle event? 



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


More information about the cdi-dev mailing list