Class LocationRepositoryImpl
- java.lang.Object
-
- org.optaweb.vehiclerouting.plugin.persistence.LocationRepositoryImpl
-
- All Implemented Interfaces:
LocationRepository
@Component class LocationRepositoryImpl extends Object implements LocationRepository
-
-
Constructor Summary
Constructors Constructor Description LocationRepositoryImpl(LocationCrudRepository repository)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LocationcreateLocation(Coordinates coordinates, String description)Create a location with a unique ID.Optional<Location>find(long locationId)Find a location by its ID.List<Location>locations()Get all locations.voidremoveAll()Remove all locations from the repository.LocationremoveLocation(long id)Remove a location with the given ID.
-
-
-
Constructor Detail
-
LocationRepositoryImpl
@Autowired LocationRepositoryImpl(LocationCrudRepository repository)
-
-
Method Detail
-
createLocation
public Location createLocation(Coordinates coordinates, String description)
Description copied from interface:LocationRepositoryCreate a location with a unique ID.- Specified by:
createLocationin interfaceLocationRepository- Parameters:
coordinates- location's coordinatesdescription- description of the location- Returns:
- a new location
-
locations
public List<Location> locations()
Description copied from interface:LocationRepositoryGet all locations.- Specified by:
locationsin interfaceLocationRepository- Returns:
- all locations
-
removeLocation
public Location removeLocation(long id)
Description copied from interface:LocationRepositoryRemove a location with the given ID.- Specified by:
removeLocationin interfaceLocationRepository- Parameters:
id- location ID- Returns:
- the removed location
-
removeAll
public void removeAll()
Description copied from interface:LocationRepositoryRemove all locations from the repository.- Specified by:
removeAllin interfaceLocationRepository
-
find
public Optional<Location> find(long locationId)
Description copied from interface:LocationRepositoryFind a location by its ID.- Specified by:
findin interfaceLocationRepository- 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
-
-