> On Jul 25, 7:33 am, xar...@gmail.com wrote:
>
[quoted text clipped - 58 lines]
> using reflection for this sort of thing is a Bad Idea (TM). Perhaps
> if you shared your goal with the group, we could suggest a better way.
thank you man. although it sounds me funky to get an error with the
int/Integer assignaments (wrapper classes shouldn't give such
problems), i've tried your solution, and this one too:
int newBonus = f.getInt(boss);
but i keep on getting the same error at the same line. and finally
yes, my project is simply to learn more about reflection. i know i
could have simply done this via standard set/get methods :)
plus, to allow a pure OO programming, i'd avoid to change the type of
bonus from Integer to int :)
xareon@gmail.com - 25 Jul 2007 16:09 GMT
On 25 Lug, 16:59, xar...@gmail.com wrote:
> > On Jul 25, 7:33 am, xar...@gmail.com wrote:
>
[quoted text clipped - 70 lines]
> plus, to allow a pure OO programming, i'd avoid to change the type of
> bonus from Integer to int :)
ty, i found the problem: it was just that getInt() method returns an
int, while my field was an Integer. i should have used
Integer newBonus = (Integer)f.get(boss);
get returns an object, that i just cast to Integer. sometimes i feel
so stupid :x
xareon@gmail.com - 25 Jul 2007 16:14 GMT
On 25 Lug, 16:59, xar...@gmail.com wrote:
> > On Jul 25, 7:33 am, xar...@gmail.com wrote:
>
[quoted text clipped - 70 lines]
> plus, to allow a pure OO programming, i'd avoid to change the type of
> bonus from Integer to int :)
ty, i found the problem: it was just that getInt() method returns an
int, while my field was an Integer. i should have used
Integer newBonus = (Integer)f.get(boss);
get returns an object, that i just cast to Integer. sometimes i feel
so stupid :x
xareon@gmail.com - 25 Jul 2007 16:18 GMT
On 25 Lug, 16:59, xar...@gmail.com wrote:
> > On Jul 25, 7:33 am, xar...@gmail.com wrote:
>
[quoted text clipped - 70 lines]
> plus, to allow a pure OO programming, i'd avoid to change the type of
> bonus from Integer to int :)
ty, i found the problem: it was just that getInt() method returns an
int, while my field was an Integer. i should have used
Integer newBonus = (Integer)f.get(boss);
get returns an object, that i just cast to Integer. sometimes i feel
so stupid :x
> On Jul 25, 7:33 am, xar...@gmail.com wrote:
>
[quoted text clipped - 58 lines]
> using reflection for this sort of thing is a Bad Idea (TM). Perhaps
> if you shared your goal with the group, we could suggest a better way.
thank you man. although it sounds me funky to get an error with the
int/Integer assignaments (wrapper classes shouldn't give such
problems), i've tried your solution, and this one too:
int newBonus = f.getInt(boss);
but i keep on getting the same error at the same line. and finally
yes, my project is simply to learn more about reflection. i know i
could have simply done this via standard set/get methods :)
plus, to allow a pure OO programming, i'd avoid to change the type of
bonus from Integer to int :)