Interface VehicleRepository

  • All Known Implementing Classes:
    VehicleRepositoryImpl

    public interface VehicleRepository
    Defines repository operations on vehicles.
    • Method Detail

      • createVehicle

        Vehicle createVehicle​(int capacity)
        Create a vehicle with a unique ID.
        Parameters:
        capacity - vehicle's capacity
        Returns:
        a new vehicle
      • createVehicle

        Vehicle createVehicle​(VehicleData vehicleData)
        Create a vehicle from the given data.
        Parameters:
        vehicleData - vehicle data
        Returns:
        a new vehicle
      • vehicles

        List<Vehicle> vehicles()
        Get all vehicles.
        Returns:
        all vehicles
      • removeVehicle

        Vehicle removeVehicle​(long id)
        Remove a vehicle with the given ID.
        Parameters:
        id - vehicle's ID
        Returns:
        the removed vehicle
      • removeAll

        void removeAll()
        Remove all vehicles from the repository.
      • find

        Optional<Vehicle> find​(long vehicleId)
        Find a vehicle by its ID.
        Parameters:
        vehicleId - vehicle's ID
        Returns:
        an Optional containing vehicle with the given ID or empty Optional if there is no vehicle with such ID
      • update

        void update​(Vehicle vehicle)