Interface LocationRepository

  • All Known Implementing Classes:
    LocationRepositoryImpl

    public interface LocationRepository
    Defines repository operations on locations.
    • Method Detail

      • createLocation

        Location createLocation​(Coordinates coordinates,
                                String description)
        Create a location with a unique ID.
        Parameters:
        coordinates - location's coordinates
        description - description of the location
        Returns:
        a new location
      • locations

        List<Location> locations()
        Get all locations.
        Returns:
        all locations
      • removeLocation

        Location removeLocation​(long id)
        Remove a location with the given ID.
        Parameters:
        id - location ID
        Returns:
        the removed location
      • removeAll

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

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