aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Wrapper class for Flight Info Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Wrapper class for Flight Info" Watch "Wrapper class for Flight Info" New topic
Author

Wrapper class for Flight Info

Amit Kr Kumar
Ranch Hand

Joined: Feb 08, 2002
Posts: 100
Hi Ranchers
Pls suggest
Is it required to create a Wrapper class i.e. FlightInfo (set, get methods of flight) class of DataInfo for flights. I think it should be created as it will be very specific to flights information and can be passed as args and can be returned as Return Value by various methods used instead of DataInfo[]
e.g. in Flight Facade class :
FlightInfo[] search(..)
and not DataInfo[] search(..)

Why and why not ?
Amit
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

Oh, in my case, I pass the DataInfo[] directly to my FlightTableModel. This way it can show the data correctly in the JTable.
If you just get FieldInfo[] you will only get one record.
Those are two that I quickly thought of.
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Eduard Jodas
Ranch Hand

Joined: May 14, 2002
Posts: 80
I think Amid talks about FlightInfo not FieldInfo.
I understand your FlightInfo object has methods like getOriginAirport(), getDestinationAirport() and so on.
In my case I have created a FlightInfo bean, which notifies the GUI when it changes. I find it clearer and cleaner. I also think it is more comfortable for the GUI makers to work with FlightInfo objects than with DataInfo objects. For exemple, my FlightInfo getAvailableSeats() method return an int, not a String, so it is easier to make calculations.
I don't think it is required, though.
Amit Kr Kumar
Ranch Hand

Joined: Feb 08, 2002
Posts: 100
Yes i mean FlightInfo Bean which has methods like
- getFlightNumber()
- getOriginAirport()
- getDestinationAirport()
etc etc
Mark what do u say abt this ??
Amit
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

That's fine, I just had that in my Facade. I only had 6 or 7 methods in the Facade and it handled all that, like getting Available Seats, Origin Airports to put into my JCombobox, etc.
So your design that way is fine, it really is one and the same, just different names.
Mark
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Wrapper class for Flight Info