Hi Piotr,

I think the way Taro introduced that function was to give possibility of
change the algorithm when we want.
So for subclasses I think has more sense to override, and for uses of the
class has more sense to assign an external function.
IOW, having the original validation function in a specialized class makes
no sense to me, overriding and specializing seems more direct to the
current case.

Hope this make more sense now.

Thanks

Carlos



El sáb., 20 abr. 2019 a las 0:58, Piotr Zarzycki (<[email protected]>)
escribió:

> Hi Carlos,
>
> Cool. I see that your implementation has one main difference. I used
> validateFunction to run validation instead overriding anything.
> This was for me the most obvious way, but seeing your implementation I'm
> wondering - did I understand wrong the meaning of validateFunction? Look
> into constructor of my class [1].
>
> The rest of the code is pretty similar.
>
> [1] https://paste.apache.org/x9kk
>
> Thanks,
> Piotr
>
> On Sat, Apr 20, 2019, 12:25 AM Carlos Rovira <[email protected]>
> wrote:
>
> > Hi Piotr,
> >
> > sorry, I have this in my real project and forgot to transfer to Royale,
> > will do now, so you can have it and check it you see there's something
> Greg
> > or I forgot.
> >
> > thanks
> >
> > El vie., 19 abr. 2019 a las 15:43, Piotr Zarzycki (<
> > [email protected]>) escribió:
> >
> > > Hi Carlos,
> > >
> > > I'm looking into Validator, cause I have started using it more. I did
> > port
> > > EmailValidator from Flex to Jewel in my application but I'm not sure
> > > whether it is actually require here - If yes I can commit it.
> > >
> > > However I would like to ask why actually inside validator class when
> you
> > > setup such properties like trigger/triggerEvent you are using private
> > > fields instead of a public one ? Here is the crucial example [1]
> > >
> > > Setting that to private field causes code duplication, cause in
> > > StringValidation you are registering to the triggerEvent [2], which
> > > actually would be done in trigger [3] property of Validator class.
> > >
> > > Is there any reason to do not user public properties by you ? I would
> > love
> > > to change that.
> > >
> > > [1]
> > >
> > >
> >
> https://github.com/apache/royale-asjs/blob/8677a93c28ef5ff85123071b484429b8b17cd3ad/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/Validator.as#L166
> > > [2]
> > >
> > >
> >
> https://github.com/apache/royale-asjs/blob/8677a93c28ef5ff85123071b484429b8b17cd3ad/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/StringValidator.as#L72
> > > [3]
> > >
> > >
> >
> https://github.com/apache/royale-asjs/blob/8677a93c28ef5ff85123071b484429b8b17cd3ad/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/Validator.as#L116
> > >
> > > Thanks,
> > > --
> > >
> > > Piotr Zarzycki
> > >
> > > Patreon: *https://www.patreon.com/piotrzarzycki
> > > <https://www.patreon.com/piotrzarzycki>*
> > >
> >
> >
> > --
> > Carlos Rovira
> > http://about.me/carlosrovira
> >
>


-- 
Carlos Rovira
http://about.me/carlosrovira

Reply via email to