And fromString(String) like jaxrs I think. Can work even if it will need work for cdi Le 21 déc. 2014 12:11, "Oliver B. Fischer" <[email protected]> a écrit :
> See below for my comments... > > Am 18.12.14 um 00:13 schrieb Romain Manni-Bucau: > >> 2014-12-18 0:05 GMT+01:00 Anatole Tresch <[email protected]>: >> >>> - >>> >>> String as well as other types should be supported. >>> - >>> >>> We should limit to types we can handle to start I think (until we >> finished other IoC integration to keep it aligned to start) >> >> So file, string, primitive wrappers, uri, inetaddress... >> > I proposed already a way to handle that: > > If the target type has a valueOf(String ...) method or > if the target type has a of(String ....) method or > if the target type has a ctor(String ...) > > use this method to convert from string to an instance of the target type > > Otherwise scan the classpath for a matching property adatper. > > // Configuration method >> *void* setStartup(@ConfigProperty *boolean* startup, >> @ConfigProperty("componentName") @WithConfig("module1") >> @DefaultValue("N/A") *String* compName){ >> ... >> } >> >> I would put default value in @ConfigProperty to avoid >> TooMuchAnnotationsException >> @WithConfig({}) for the same reason or even in @ConfigProperty(configs = >> {})? >> >> +1 > > > -- > N Oliver B. Fischer > A Schönhauser Allee 64, 10437 Berlin, Deutschland/Germany > P +49 30 44793251 > M +49 178 7903538 > E [email protected] > S oliver.b.fischer > J [email protected] > X http://xing.to/obf > >
