mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
throw exception if vehicle id is null
This commit is contained in:
parent
b610626b1d
commit
f218b9a738
1 changed files with 4 additions and 0 deletions
|
|
@ -135,6 +135,7 @@ public class VehicleImpl extends AbstractVehicle {
|
|||
private Builder(String id) {
|
||||
super();
|
||||
this.id = id;
|
||||
if (id == null) throw new IllegalArgumentException("Vehicle id must not be null.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -196,6 +197,8 @@ public class VehicleImpl extends AbstractVehicle {
|
|||
* @return start location
|
||||
*/
|
||||
public Builder setStartLocation(Location startLocation) {
|
||||
if (startLocation == null)
|
||||
throw new IllegalArgumentException("Start location of vehicle " + id + " must not be null.");
|
||||
this.startLocation = startLocation;
|
||||
return this;
|
||||
}
|
||||
|
|
@ -232,6 +235,7 @@ public class VehicleImpl extends AbstractVehicle {
|
|||
}
|
||||
|
||||
public Builder addSkill(String skill) {
|
||||
if (skill == null) throw new IllegalArgumentException("Skill of vehicle " + id + " must not be null");
|
||||
skillBuilder.addSkill(skill);
|
||||
return this;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue