You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@royale.apache.org by Hugo Ferreira <hf...@gmail.com> on 2023/04/03 23:25:02 UTC

Iterate thru object properties in release build

Hi,

This works on debug build:

for (var field:String in this)
{
if (Strings.endsWith(field, "_"))
field = field.substr(0, field.length - 1);

....

}

Because the value object preserves all the variables, however in release
build this does not work anymore because the build release change all
variable names
and inject and getter and setter with the original names.

I search a lot in google and didnt find a way to iterate thru the object
with the getter names (find the getter names).

Re: Iterate thru object properties in release build

Posted by Hugo Ferreira <hf...@gmail.com>.
Thanks.

Greg Dove <gr...@gmail.com> escreveu no dia terça, 4/04/2023 à(s) 00:28:

> Hey Hugo,
>
> What exactly is the 'this' instance?
> If it is a Royale class, then you do have the option of using the
> Reflection lib.
>
>
>
>
>
>
>
>
> On Tue, Apr 4, 2023 at 11:25 AM Hugo Ferreira <hf...@gmail.com>
> wrote:
>
> > Hi,
> >
> > This works on debug build:
> >
> > for (var field:String in this)
> > {
> > if (Strings.endsWith(field, "_"))
> > field = field.substr(0, field.length - 1);
> >
> > ....
> >
> > }
> >
> > Because the value object preserves all the variables, however in release
> > build this does not work anymore because the build release change all
> > variable names
> > and inject and getter and setter with the original names.
> >
> > I search a lot in google and didnt find a way to iterate thru the object
> > with the getter names (find the getter names).
> >
>

Re: Iterate thru object properties in release build

Posted by Greg Dove <gr...@gmail.com>.
Hey Hugo,

What exactly is the 'this' instance?
If it is a Royale class, then you do have the option of using the
Reflection lib.








On Tue, Apr 4, 2023 at 11:25 AM Hugo Ferreira <hf...@gmail.com>
wrote:

> Hi,
>
> This works on debug build:
>
> for (var field:String in this)
> {
> if (Strings.endsWith(field, "_"))
> field = field.substr(0, field.length - 1);
>
> ....
>
> }
>
> Because the value object preserves all the variables, however in release
> build this does not work anymore because the build release change all
> variable names
> and inject and getter and setter with the original names.
>
> I search a lot in google and didnt find a way to iterate thru the object
> with the getter names (find the getter names).
>