Re: can a WODisplayGroup use a subclass of an entity?
Re: can a WODisplayGroup use a subclass of an entity?
- Subject: Re: can a WODisplayGroup use a subclass of an entity?
- From: "Nathan C. Hampton" <email@hidden>
- Date: Wed, 10 Sep 2003 09:41:27 -0500
Not that EOGenerator doesn't look like a great tool, but I usually tend
to go for simpler fixes. What if you just reversed your workaround?
That is, why not define public class Reservation, which includes
duration() et. al., and just add "extends Reservation" to the class
declaration for Holiday when you are forced (kicking and screaming, I'm
sure) to re-generate the code? This also makes these methods reusable
if you ever need another kind of reservation.
--NCH
On Tuesday, September 9, 2003, at 07:10 PM, Marek Wawrzyczny wrote:
What you need is to use the EOGenerator:
http://www.rubicode.com/Software/EOGenerator/
It comes with pretty good docs.
On Wednesday, Sep 10, 2003, at 09:30 Australia/Sydney, Denis Stanton
wrote:
I thought I had a good idea to clean up my code a bit, but it's not
working. Maybe the idea was flawed, or maybe I'm just missing a
detail.
I have an entity (Holiday) that represents a holiday reservation.
There are a number of common operations I need to perform on instances
of this entity. For example, the table stores start and finish date
and I frequently need to calculate duration by subtracting one from
the
other.
To do this I simply added a public int duration(){...} method to
Holiday.java. I have added a number of methods like this. My worry
is
I am still developing the database and every time I extend the entity
definition I generate the java class again. I have to be very careful
to merge the generated code with my extended class. I'm worried that
I
could slip up and lose my custom code. It finally dawned on me that I
was not making use of Java inheritance. Instead of adding methods to
Holiday.java I should define public class HolidayExt extends Holiday
{...} and add my custom code there. Then in my WOComponents I always
declare instance to be HolidayExt holidayItem = new HolidayExt()
Marek Wawrzyczny
software engineer
-------------------------->
ish group pty ltd
7 Darghan St Glebe 2037 Australia
phone +61 2 9660 1400 fax +61 2 9660 7400
http www.ish.com.au | email email@hidden
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.