ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clinton Begin" <clinton.be...@gmail.com>
Subject Re: Setters, gettes and public fields
Date Fri, 18 Jul 2008 14:31:29 GMT
No, it shouldn't.  iBATIS will use fields, but only if it can't find the
property -- public or private...

That said, this is a really bad design and I can't imagine why on earth
you'd want to do something like that... :-)

Clinton

On Fri, Jul 18, 2008 at 8:32 AM, Davide Rogora <drogora@unionefiduciaria.it>
wrote:

>  Hi,
> my company is using iBatis for our web application and we are very happy
> with it.
>
> Actually in our model classes we have private fields and public getters and
> setters (like javaBeans specification recommends).
> For some reasons we are planning to do a refactoring in our project, by
> converting private fields in public fields (but leaving the public getters
> and setters)
>
> i.e.
> *Class person before refactoring*
> public class Person {
>
> *    private* String firstName;
> *    private* String lastName;
>
> *    public* String getFirstName() {
> *        return* firstName;
>     }
> *    public* *void* setFirstName(String firstName) {
> *        this*.firstName = firstName;
>     }
>
> *    public* String getLastName() {
> *        return* lastName;
>     }
> *    public* *void* setLastName(String lastName) {
> *        this*.lastName = lastName;
>     }
>
> }
>
>  *Class person AFTER refactoring*
> public class Person {
>
> *    public* String firstName; // Changed to public
> *    public* String lastName;  // Changed to public
>
> *    public* String getFirstName() {
> *        return* firstName;
>     }
> *    public* *void*
> setFirstName(String firstName) {
> *        this*.firstName = firstName;
>     }
>
> *    public* String getLastName() {
> *        return* lastName;
>     }
> *    public* *void* setLastName(String lastName) {
> *        this*.lastName = lastName;
>     }
>
> }
>
> Do you think that the presence of both public field and getter and setter
> will cause problems to iBatis?
>
> Thanks,
> Davide.
>
>
>
> -----
> Davide Rogora
> Unione Fiduciaria S.p.A. - Società Fiduciaria e di Servizi delle Banche
> Popolari Italiane
> Area Informatica
> via Olmetto, 1
> 20123 Milano
> Tel. 02 72.422.423
> e-mail: drogora@unionefiduciaria.it
>
> Le dichiarazioni contenute nel presente messaggio nonché nei suoi eventuali
> allegati devono essere attribuite esclusivamente al mittente e non possono
> essere considerate come trasmesse o autorizzate da Unione Fiduciaria S.p.A.;
> le medesime dichiarazioni non impegnano Unione Fiduciaria S.p.A. nei
> confronti del destinatario o di terzi. Unione Fiduciaria S.p.A. non assume
> alcuna responsabilità per eventuali intercettazioni, modifiche o
> danneggiamenti del presente messaggio e-mail. Qualsiasi utilizzo non
> autorizzato del presente messaggio nonchè dei suoi allegati è vietato e
> potrebbe costituire reato. Se avete ricevuto erroneamente il presente
> messaggio, saremmo grati se, via e-mail, ce ne comunicaste la ricezione e
> provvedeste alla distruzione del messaggio stesso e dei suoi eventuali
> allegati.
>
>
>
> The statements and opinions espressed in this e-mail message are those of
> the author of the message and do not necessarily represent those of Unione
> Fiduciaria S.p.A. Besides, the contents of this message shall be understood
> as neither given nor endorsed by Unione Fiduciaria S.p.A. Unione Fiduciaria
> S.p.A. does not accept liability for corruption, interception or amendment,
> if any, or the consequences thereof. Any unauthorized use of this e-mail or
> any of its attachments is prohibited and could constitute an offence. If
> You are not the intended addressee please advise immediately the sender by
> using the reply facility in Your e-mail software and destroy the message and
> its attachments.
>
>

Mime
View raw message