1 Jun 2009 20:33
Re: reflection on fields
Nils Kilden-Pedersen <nilskp <at> gmail.com>
2009-06-01 18:33:40 GMT
2009-06-01 18:33:40 GMT
I'm guessing this could be for Javaspace Entry objects, which must contain public fields. If not, that's another example of the need for public fields if full Java framework compatibility is a goal. I can smell another annotation.
On Fri, May 29, 2009 at 3:14 PM, Daniel Mahler <dmahler <at> gmail.com> wrote:
Alex,
Thanks, but that is not quite what I need.
The <at> BeanProperty annotation adds getter/setter methods
with JavaBeans compliant names.
That makes them bean properties, but not fields.
The Java code I am calling does not use the beans interface,
it just calls getFields on the class and looks in the result for what it wants,
but Scala classes do not have public fields (from Java's point of view).
I suspect that there is no way to get Scala objects to have public java fields,
but I would love to be wrong.
Daniel
On 5/29/09, Alex Boisvert <boisvert <at> intalio.com> wrote:
> This may help,
> http://scala.sygneca.com/code/defining-bean-properties
>
> On Fri, May 29, 2009 at 9:36 AM, Daniel Mahler <dmahler <at> gmail.com> wrote:
>
>> I am trying to pass a Scala object to some Java code,
>> that calls getFields on the objects class,
>> and it expects to find certain fields there.
>> Scala normally compiles fields into a private Java field,
>> with a getter/setter methods.
>> Is there any way to get fields of a Scala object to be visible
>> as fields in via Reflection?
>>
>> thanks
>> Daniel
>>
>
RSS Feed