Access getters and setters through Reflect?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Access getters and setters through Reflect?

Julian Schmid
Hi,

I'm currently searching for a way to find out if a field in an object
has a getter and/or setter during runtime, so that I can call it with a
Reflect method (Reflect.setField() does not use the setter, it access
the field directly).
I hope there is someway to get the method name of a field getter/setter.

Greets, and thanks for all answers in advance,
Julian



--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Access getters and setters through Reflect?

Robin Palotai
I stumbled upon this once, and AFAIK there isn't such method. If you
know the naming conventions, you can search for an appropriate setter
yourself, but cannot retrieve it automatically. For my own classes, I
search for setXxYy for variables named xx_yy, but that's kind of
customary.

Cheers!
Robin

On Tue, Nov 18, 2008 at 8:10 PM, Julian Schmid
<[hidden email]> wrote:

> Hi,
>
> I'm currently searching for a way to find out if a field in an object
> has a getter and/or setter during runtime, so that I can call it with a
> Reflect method (Reflect.setField() does not use the setter, it access
> the field directly).
> I hope there is someway to get the method name of a field getter/setter.
>
> Greets, and thanks for all answers in advance,
> Julian
>
>
>
> --
> haXe - an open source web programming language
> http://haxe.org
>

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Access getters and setters through Reflect?

Julian Schmid
Would be a nice feature for a new version of haxe, if there were some
way to access wich class fields have getters and/or setters (I'm still
hoping that there is some kind of hidden variable or something ;) ).

Greets Julian

Robin Palotai schrieb:

> I stumbled upon this once, and AFAIK there isn't such method. If you
> know the naming conventions, you can search for an appropriate setter
> yourself, but cannot retrieve it automatically. For my own classes, I
> search for setXxYy for variables named xx_yy, but that's kind of
> customary.
>
> Cheers!
> Robin
>
> On Tue, Nov 18, 2008 at 8:10 PM, Julian Schmid
> <[hidden email]> wrote:
>  
>> Hi,
>>
>> I'm currently searching for a way to find out if a field in an object
>> has a getter and/or setter during runtime, so that I can call it with a
>> Reflect method (Reflect.setField() does not use the setter, it access
>> the field directly).
>> I hope there is someway to get the method name of a field getter/setter.
>>
>> Greets, and thanks for all answers in advance,
>> Julian
>>
>>
>>
>> --
>> haXe - an open source web programming language
>> http://haxe.org
>>
>>    
>
>  


--
haXe - an open source web programming language
http://haxe.org