* @param type a <code>String</code> with the vehicle type.
* @param deliveryDate a <code>Calendar</code> with the delivery date.
* @return a <code>Vehicle</code> object.
*/
public Vehicle createVehicleObject ( String id, String type, Calendar deliveryDate ) {
Vehicle vehicle = null;
if ( type.equalsIgnoreCase("MyBus Single Decker") ) {
vehicle = (Vehicle) theContext.getBean("singleDeckerBus");
} else if ( type.equalsIgnoreCase("MyBus Double Decker") ) {
vehicle = (Vehicle) theContext.getBean("doubleDeckerBus");
} else if ( type.equalsIgnoreCase("MyBus Bendy") ) {
vehicle = (Vehicle) theContext.getBean("bendyBus");
} else if ( type.equalsIgnoreCase("MyTram Tram1") ) {
vehicle = (Vehicle) theContext.getBean("tram");
}
vehicle.setRegistrationNumber(id);
System.out.println("This vehicle has registration number " + vehicle.getRegistrationNumber());
vehicle.setDeliveryDate(deliveryDate);
return (Vehicle) vehicle.clone();
}