> As I said, that does not work for Book but it's fine for the other
> attributes.
[quoted text clipped - 11 lines]
> Apparently the cast was implicit for String, as it's a String but not
> for Book...
There was no cast involved, for the first call, because getField takes a
String parameter, and name is a String. However, I'm not 100% sure you
are expecting what will happen at run time. getField will look for a
field whose identifier matches the value of the name field at the time
of the call.
Patricia
tchou - 07 Nov 2006 14:44 GMT
Indeed, you're right. The field is not found as it takes the value of
the string.
Thank you Patricia,
Florence.
Patricia Shanahan a ?crit :
> There was no cast involved, for the first call, because getField takes a
> String parameter, and name is a String. However, I'm not 100% sure you
[quoted text clipped - 3 lines]
>
> Patricia
Daniel Pitts - 07 Nov 2006 19:50 GMT
> Patricia Shanahan a écrit :
>
[quoted text clipped - 10 lines]
>
> Florence.
No one has thought to point out that Reflection is a dangerous path to
go down.
There is probably a better solution to what you are trying to do. Why
do you need access to the Field through reflection?