Re: need to dynamically set a java field of a known name

2009-07-09 Thread David Goodenough
You can do it in real java, but as reflection is not supported in GWT it would not work in GWT. In real java you would say:- Test test = new Test(); Test.getClass().getField(value).set(test,some value); Note that if value is a private or protected field then you need to use getDeclaredField

Re: need to dynamically set a java field of a known name

2009-07-09 Thread george9
Hi David, having worked 10 years in Java I know how to use reflection:) Sorry it was not obvious from my post - I was just inquiring whether there's a GWT method that could be used in client code - some method that escaped my search. Anyway, I've solved this problem yesterday by writing a

need to dynamically set a java field of a known name

2009-07-08 Thread george9
When you have a typed class, say class Test { String value; } is it somehow possible to set field 'value' without a static reference in the code? I'm looking for an equivalent to JavaScript's: var Test = { }; Test[value] = some value; JSNI can access a java field via the