You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Matthias Wessendorf <ma...@apache.org> on 2006/11/24 13:03:51 UTC

[Validators] minor issue's with usage of getXXX() instead of _xxx

Hi,

when you override a standard validator and provide a set/getMaximum()
(for instance) and call inside validate() the super.validate() and
only *decorate* the ExceptionHandling, you will notice that the the
set value (here the maximum) will be ignored, since validate doesn't
use getXXX() inside of validate. It uses _xxx directly.

Should I change that ?

-- 
Matthias Wessendorf
http://tinyurl.com/fmywh

further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com

Re: [Validators] minor issue's with usage of getXXX() instead of _xxx

Posted by Matthias Wessendorf <ma...@apache.org>.
yeah,

I was just wondering, what you guys think about that ...
Since I ran into that *issue* :)

well, I am fine with keeping the current state :)
since that looks *cleaner* to me ...

-M

On 11/24/06, Manfred Geiler <ma...@gmail.com> wrote:
> Yes, academically seen, whenever there is a non-final getter, all
> methods within a class should use the getter instead of directly
> accessing the field.
>
> Or expressed the other way round:
> Whenever a class accesses a field directly the corresponding (public
> or protected) getter method should be defined as "final".
> Sounds logical, but nobody adheres this - including me!   ;-)
>
> To your question:
> Yes, change direct field access to getter access, please.
>
> Manfred
>
>
>
>
> On 11/24/06, Matthias Wessendorf <ma...@apache.org> wrote:
> > Hi,
> >
> > when you override a standard validator and provide a set/getMaximum()
> > (for instance) and call inside validate() the super.validate() and
> > only *decorate* the ExceptionHandling, you will notice that the the
> > set value (here the maximum) will be ignored, since validate doesn't
> > use getXXX() inside of validate. It uses _xxx directly.
> >
> > Should I change that ?
> >
> > --
> > Matthias Wessendorf
> > http://tinyurl.com/fmywh
> >
> > further stuff:
> > blog: http://jroller.com/page/mwessendorf
> > mail: mwessendorf-at-gmail-dot-com
> >
>


-- 
Matthias Wessendorf
http://tinyurl.com/fmywh

further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com

Re: [Validators] minor issue's with usage of getXXX() instead of _xxx

Posted by Manfred Geiler <ma...@gmail.com>.
Yes, academically seen, whenever there is a non-final getter, all
methods within a class should use the getter instead of directly
accessing the field.

Or expressed the other way round:
Whenever a class accesses a field directly the corresponding (public
or protected) getter method should be defined as "final".
Sounds logical, but nobody adheres this - including me!   ;-)

To your question:
Yes, change direct field access to getter access, please.

Manfred




On 11/24/06, Matthias Wessendorf <ma...@apache.org> wrote:
> Hi,
>
> when you override a standard validator and provide a set/getMaximum()
> (for instance) and call inside validate() the super.validate() and
> only *decorate* the ExceptionHandling, you will notice that the the
> set value (here the maximum) will be ignored, since validate doesn't
> use getXXX() inside of validate. It uses _xxx directly.
>
> Should I change that ?
>
> --
> Matthias Wessendorf
> http://tinyurl.com/fmywh
>
> further stuff:
> blog: http://jroller.com/page/mwessendorf
> mail: mwessendorf-at-gmail-dot-com
>