mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-18 16:29:51 +00:00
Outlaw empty strings in location IDs.
This commit is contained in:
parent
95d0a31675
commit
ca895596ba
1 changed files with 3 additions and 1 deletions
|
@ -28,6 +28,7 @@ import javax.annotation.Nullable;
|
||||||
import com.google.common.base.MoreObjects;
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.MoreObjects.ToStringHelper;
|
import com.google.common.base.MoreObjects.ToStringHelper;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
import com.google.common.base.Strings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Andreas Schildbach
|
* @author Andreas Schildbach
|
||||||
|
@ -50,6 +51,7 @@ public final class Location implements Serializable
|
||||||
this.place = place;
|
this.place = place;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
||||||
|
checkArgument(id == null || id.length() > 0, "ID cannot be the empty string");
|
||||||
checkArgument(place == null || name != null, "place '%s' without name cannot exist", place);
|
checkArgument(place == null || name != null, "place '%s' without name cannot exist", place);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +114,7 @@ public final class Location implements Serializable
|
||||||
|
|
||||||
public final boolean hasId()
|
public final boolean hasId()
|
||||||
{
|
{
|
||||||
return id != null;
|
return !Strings.isNullOrEmpty(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean hasLocation()
|
public final boolean hasLocation()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue