Re: [configuration2]: AbstractConfiguration::getArray

2016-05-02 Thread Jörg Schaible
Oliver Heger wrote: > > > > Am 29.04.2016 um 20:36 schrieb Jörg Schaible: >> c...@honton.org wrote: >> >>> Jorge, >>> >>> You could create a different named method for each primitive array >>> type. Would be a pain to use in a generic fashion. >> >> >> [snip] >> >> I agree with a method

Re: [configuration2]: AbstractConfiguration::getArray

2016-04-29 Thread Oliver Heger
Am 29.04.2016 um 20:36 schrieb Jörg Schaible: > c...@honton.org wrote: > >> Jorge, >> >> You could create a different named method for each primitive array >> type. Would be a pain to use in a generic fashion. > > > [snip] > > I agree with a method returning explicitly an array, but that

Re: [configuration2]: AbstractConfiguration::getArray

2016-04-29 Thread Jörg Schaible
c...@honton.org wrote: > Jorge, > > You could create a different named method for each primitive array > type. Would be a pain to use in a generic fashion. [snip] I agree with a method returning explicitly an array, but that has been nonsense in first place. As I already pointed out, the

Re: [configuration2]: AbstractConfiguration::getArray

2016-04-29 Thread chas
Jorge, You could create a different named method for each primitive array type. Would be a pain to use in a generic fashion. Play with the following sample code to see why the return type needs to be Object. regards, chas import java.lang.reflect.Array; import java.lang.reflect.Field;

Re: [configuration2]: AbstractConfiguration::getArray

2016-04-29 Thread Jörg Schaible
Hi Oliver, Oliver Heger wrote: > Hi Jörg, > > Am 28.04.2016 um 16:34 schrieb Jörg Schaible: >> Chas Honton wrote: >> >>> Try casting Object[] to long[]. The compiler and the runtime will >>> complain. >> >> It is not about a cast, it's about returning the proper object. And it >> has nothing

Re: [configuration2]: AbstractConfiguration::getArray

2016-04-28 Thread Oliver Heger
Hi Jörg, Am 28.04.2016 um 16:34 schrieb Jörg Schaible: > Chas Honton wrote: > >> Try casting Object[] to long[]. The compiler and the runtime will >> complain. > > It is not about a cast, it's about returning the proper object. And it has > nothing to do with primitives, because you cannot

Re: [configuration2]: AbstractConfiguration::getArray

2016-04-28 Thread Jörg Schaible
Chas Honton wrote: > Try casting Object[] to long[]. The compiler and the runtime will > complain. It is not about a cast, it's about returning the proper object. And it has nothing to do with primitives, because you cannot cast e.g. Object[] to String[] either. > >> On Apr 27, 2016, at

Re: [configuration2]: AbstractConfiguration::getArray

2016-04-28 Thread Chas Honton
Try casting Object[] to long[]. The compiler and the runtime will complain. > On Apr 27, 2016, at 11:59 PM, Jörg Schaible > wrote: > > Hi Oliver, > > Oliver Heger wrote: > >> Hi Rainer, >> >>> Am 27.04.2016 um 21:22 schrieb Rainer Hirschmiller: >>> Hi. >>>

Re: [configuration2]: AbstractConfiguration::getArray

2016-04-28 Thread Jörg Schaible
Hi Oliver, Oliver Heger wrote: > Hi Rainer, > > Am 27.04.2016 um 21:22 schrieb Rainer Hirschmiller: >> Hi. >> >> I wonder why AbstractConfiguration::getArray(cls, key) returns a single >> object, not an array of objects? Can somebody explain why the caller >> have to make an explicit cast? >>

[configuration2]: AbstractConfiguration::getArray

2016-04-27 Thread Rainer Hirschmiller
Hi. I wonder why AbstractConfiguration::getArray(cls, key) returns a single object, not an array of objects? Can somebody explain why the caller have to make an explicit cast? e.g. AbstractConfiguration = ; Object obj = configuration.getArray(String.class, "key); // expected Object[]