Re: Of Inheritance and AwakeFromInsertion
Re: Of Inheritance and AwakeFromInsertion
- Subject: Re: Of Inheritance and AwakeFromInsertion
- From: David LeBer <email@hidden>
- Date: Wed, 19 Mar 2008 08:33:24 -0400
On 19-Mar-08, at 8:21 AM, David Avendasora wrote:
Hi all,
I've run into something that _seems_ to work, but just seems "wrong"
and I don't see how to do it "right".
I have the following inheritance structure in my model:
LotCode (NOT abstract)
ManufacturedBatch extends LotCode.
When I call awakeFromInsertion on the superclass I do it as follows :
public void awakeFromInsertion(EOEditingContext ec) {
super.awakeFromInsertion(ec);
if (lotCodeType() == null) {
setLotCodeType(1);
}
}
But when I call awakeFromInsertion on the subclass I have to do this:
public void awakeFromInsertion(EOEditingContext ec) {
super.awakeFromInsertion(ec);
if (lotCodeType() == null || lotCodeType.equals(1)) {
setLotCodeType(1);
}
}
I've never used a concrete superclass but how about:
Superclass:
public void awakeFromInsertion(EOEditingContext ec) {
super.awakeFromInsertion(ec);
if (lotCodeType() == null) setLotCodeType(1);
}
Subclass:
public void awakeFromInsertion(EOEditingContext ec) {
if (lotCodeType() == null) setLotCodeType(2);
super.awakeFromInsertion(ec);
}
;david
--
David LeBer
Codeferous Software
'co-def-er-ous' adj. Literally 'code-bearing'
site: http://codeferous.com
blog: http://davidleber.net
profile: http://www.linkedin.com/in/davidleber
--
Toronto Area Cocoa / WebObjects developers group:
http://tacow.org
_______________________________________________
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