On Thu, Nov 18, 2010 at 04:11:24PM +0100, Jakob Eriksson wrote:
> > look at lines 99 through 142 of "ersatz/fun.src" (actual version), you
> > see a lot of tedious type ('instanceof') checks. And they don't even
> > cover all possible cases! The same would be required for the opposite
> > direction. Or does anybody know a better way?
> 
> Is this related to introspection?
> http://stackoverflow.com/questions/2044446/java-introspection-and-reflection

Yes, I'm using the reflection API to find out classes and fields.

I say that the above code is a mess because it still has to check for
each possible type and take the appropriate action. As you can see, it
covers bytes, characters, integers, longs, doubles, bigIntegers,
strings, objects, byte arrays, char arrays, int arrays, long arrays and
double arrays. Other types, like short integers, or string arrays etc.
are not covered (and I hope they are not such important). BTW, I just
notice that booleans (and boolean arrays) are also missig; booleans
might be needed.

I cannot see a generic way to do that.

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to