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
0dd16277d5
commit
ae1d4004a5
1 changed files with 4 additions and 0 deletions
|
|
@ -135,6 +135,7 @@ public class VehicleImpl extends AbstractVehicle {
|
||||||
private Builder(String id) {
|
private Builder(String id) {
|
||||||
super();
|
super();
|
||||||
this.id = id;
|
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
|
* @return start location
|
||||||
*/
|
*/
|
||||||
public Builder setStartLocation(Location startLocation) {
|
public Builder setStartLocation(Location startLocation) {
|
||||||
|
if (startLocation == null)
|
||||||
|
throw new IllegalArgumentException("Start location of vehicle " + id + " must not be null.");
|
||||||
this.startLocation = startLocation;
|
this.startLocation = startLocation;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
@ -232,6 +235,7 @@ public class VehicleImpl extends AbstractVehicle {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder addSkill(String skill) {
|
public Builder addSkill(String skill) {
|
||||||
|
if (skill == null) throw new IllegalArgumentException("Skill of vehicle " + id + " must not be null");
|
||||||
skillBuilder.addSkill(skill);
|
skillBuilder.addSkill(skill);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue