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: Parameterised constructors
Date Thu, 21 Sep 2006 06:28:58 GMT
No, you still need to write the setter, but make it private.  Like this:

public class Foo {

*private *String foo;

public String getFoo() {
    return foo;
}
private void setFoo(String foo) {
    this.foo = foo;
}

}


On 9/20/06, MCCORMICK, Paul <Paul.McCORMICK@doir.wa.gov.au> wrote:
>
>  How do private setters work?  Could I set the 'foo' property using the
> result map below?  Is there anything I have to do to the jmv to allow it
> access to the private field?
>
> <resultMap class="Foo">
>     <result property="foo" column="FOOBA">
> </resultMap>
>
> public class Foo {
>
> *private* String foo;
>
> public String getFoo() {
>     return foo;
> }
>
> }
>
> Thanks,
> Paul
>
>
>  ------------------------------
> *From:* Clinton Begin [mailto:clinton.begin@gmail.com]
> *Sent:* Tuesday, 19 September 2006 3:23 AM
> *To:* user-java@ibatis.apache.org
> *Subject:* Re: Parameterised constructors
>
> As a temporary alternative we do support private setters as of 2.2.0.
>
> Constructor injection is supported in the .NET version.  The two codebases
> are somewhat similar, so we could always check on their approach to it.
>
> Clinton
>
> On 9/18/06, Jeff Butler <jeffgbutler@gmail.com> wrote:
> >
> >  I remember some folks asking about this, but no commitment to do it.
> > It would require quite a change to the way iBATIS processes result sets.
> > Translation: don't expect this anytime soon.
> >
> > BTW, the Sun patterns web site has some information about an immutable
> > transfer object pattern here:
> >
> > http://java.sun.com/blueprints/patterns/TransferObject.html
> >
> > The basic idea is that you create an interface for the immutable part,
> > and a mutable static inner class for initializing.  This does work with
> > iBATIS.  But one warning - we used this pattern on my team for a while and
> > everyone (me included) HATED it.  So we eventually went to simple JavaBeans
> > with getters AND setters.
> >
> > Jeff Butler
> >
> >
> >  On 9/18/06, Ray_Offiah@waitrose.co.uk < Ray_Offiah@waitrose.co.uk >
> > wrote:
> >
> > > Mmm ... no that's not quite it.
> > >
> > > I have a set of VO classes that are immutable. This means that all the
> > > data
> > > is added at construction.
> > >
> > >
> > >
> > > |---------+--------------------------->
> > > |         |           "Larry Meadors" |
> > > |         |           <lmeadors@apache|
> > > |         |           .org>           |
> > > |         |           Sent by:        |
> > > |         |           larry.meadors@gm|
> > > |         |           ail.com          |
> > > |         |                           |
> > > |         |                           |
> > > |         |           18/09/2006 13:10|
> > > |         |           Please respond  |
> > > |         |           to user-java    |
> > > |         |                           |
> > > |---------+--------------------------->
> > >
> > > >---------------------------------------------------------------------------------------------------------------|
> > > |
> > > |
> > > |        To:      user-java@ibatis.apache.org
> > > |
> > > |        cc:      (bcc: Ray
> > > Offiah/WRSYS/MANSERV/JLP)
> > > |
> > > |        Subject: Re: Parameterised
> > > constructors                                                              
 |
> > >
> > > >---------------------------------------------------------------------------------------------------------------|
> > >
> >
> >
> >
> >
> >
> >
> > I am not finding docs for it at the moment, either. I think that the
> > ResultObjectFactoryTest unit test does what you want. Take a look, and
> > see - if it is, please feel free to add a page to the WIKI
> > (http://opensource.atlassian.com/confluence/oss/display/IBATIS/Home )
> > on how to use it.
> >
> > Larry
> >
> >
> > On 9/18/06, Ray_Offiah@waitrose.co.uk < Ray_Offiah@waitrose.co.uk>
> > wrote:
> > >
> > > Hi there!
> > >
> > > I vaguely remember reading that parameterised constructors were being
> > > considered for Ibatis. Is this still planned for a future release, or
> > has
> > > the idea been dropped?
> > >
> > > I noticed that there was no mention of them in the documentation for
> > the
> > > latest beta, which is a bit of a shame (for me anyway; not sure how
> > many
> > > others would find them useful)
> > >
> > >
> > >
> > > **********************************************************************
> > > This email is confidential and may contain copyright material of the
> > John
> > Lewis Partnership. If you are not the intended recipient, please notify
> > us
> > immediately and delete all copies of this message. (Please note that it
> > is
> > your responsibility to scan this message for viruses). Email to and from
> >
> > the John Lewis Partnership is automatically monitored for operational
> > and
> > lawful business reasons.
> > > **********************************************************************
> > > John Lewis plc
> > > Registered in England 233462
> > > Registered office  171 Victoria Street London SW1E 5NN
> > >
> > > Websites: http://www.johnlewis.com
> > > http://www.waitrose.com
> > > http://www.johnlewispartnership.co.uk
> > >
> > > **********************************************************************
> >
> > >
> > >
> >
> >
> >
> >
> > **********************************************************************
> > This email is confidential and may contain copyright material of the
> > John Lewis Partnership. If you are not the intended recipient, please notify
> > us immediately and delete all copies of this message. (Please note that it
> > is your responsibility to scan this message for viruses). Email to and from
> > the John Lewis Partnership is automatically monitored for operational and
> > lawful business reasons.
> > **********************************************************************
> > John Lewis plc
> > Registered in England 233462
> > Registered office  171 Victoria Street London SW1E 5NN
> >
> > Websites: http://www.johnlewis.com
> > http://www.waitrose.com
> > http://www.johnlewispartnership.co.uk
> >
> > **********************************************************************
> >
> >
> >
> "DISCLAIMER: This email, including any attachments, is intended only for
> use by the addressee(s) and may contain confidential and/or personal
> information and may also be the subject of legal privilege. If you are not
> the intended recipient, you must not disclose or use the information
> contained in it. In this case, please let me know by return email, delete
> the message permanently from your system and destroy any copies.
>
> Before you take any action based upon advice and/or information contained
> in this email you should carefully consider the advice and information and
> consider obtaining relevant independent advice.
>

Mime
View raw message