File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Wrapper class for Flight Info

 
Amit Kr Kumar
Ranch Hand
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Eduard Jodas
Ranch Hand
Posts: 80
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic