Forums Register Login
Wrapper class for Flight Info
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 ?
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.
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.
Yes i mean FlightInfo Bean which has methods like
- getFlightNumber()
- getOriginAirport()
- getDestinationAirport()
etc etc
Mark what do u say abt this ??
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.
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards

All times above are in ranch (not your local) time.
The current ranch time is
Dec 16, 2017 15:41:37.