Re: Updating EOObjects
Re: Updating EOObjects
- Subject: Re: Updating EOObjects
- From: Arturo Pérez <email@hidden>
- Date: Thu, 18 Aug 2005 22:17:59 -0400
On Aug 18, 2005, at 9:41 PM, LD wrote:
Hi there,
On 19/08/2005, at 11:15 AM, Arturo Pérez wrote:
The other big thing is to follow a style of doing most of your work
in the appendToResponse() and to never mutate any on-page data
through the key values that WOBuilder can see.
I sense that appendToResponse has more important duties at hand...
Yes, probably, but for a newbie sticking with appendToResponse() will
get you started. I've yet to see anything go wrong if you do this but
all kinds of things go wrong with the keys that WOBuilder accesses
(which most consider getters/setters).
Using the above then your createAndInsertInstance would be used like
this
public void appendToResponse(....) {
if (aLicense == null) aLicense = ...createAndInsert...;
if (aPrincipal == null) aPrincipal = ...createAndInsert...;
super.appendToResponse(...);
}
I don't think that's very helpful in the OO world. Setters and getters
are the way to go so that if you need to reference the object
elsewhere in your code you don't come unstuck.
Yes, but Jonathan was asking specifically about pages. Besides,
haven't you heard that getters and setters are evil :-)
http://www.javaworld.com/javaworld/jw-09-2003/jw-0905-toolbox.html Not
that I care particularly but, without Eclipse's generate
getters&setters thing it's a pain.
i.e.,
public Licence licence() {
if ( _aLicence == null ) {
_aLicence = ( Licence )EOUtilities.createAndInsertInstance(
ec, "Licence" );
}
return aLicence;
}
public void setLicence( Licence aLicence ) {
_aLicence = aLicence;
}
and so on...
with regards,
--
LD
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden