diff --git a/enabler/src/de/schildbach/pte/dto/Location.java b/enabler/src/de/schildbach/pte/dto/Location.java index eff35386..31c0f1fa 100644 --- a/enabler/src/de/schildbach/pte/dto/Location.java +++ b/enabler/src/de/schildbach/pte/dto/Location.java @@ -39,6 +39,9 @@ public final class Location implements Serializable this.lon = lon; this.place = place; this.name = name; + + if (name == null && place != null) + throw new IllegalArgumentException("places without name cannot exist"); } public Location(final LocationType type, final String id, final String place, final String name) @@ -49,6 +52,9 @@ public final class Location implements Serializable this.lon = 0; this.place = place; this.name = name; + + if (name == null && place != null) + throw new IllegalArgumentException("places without name cannot exist"); } public Location(final LocationType type, final String id, final int lat, final int lon) @@ -91,6 +97,11 @@ public final class Location implements Serializable return lat != 0 || lon != 0; } + public final boolean hasName() + { + return name != null; + } + public final boolean isIdentified() { if (type == LocationType.STATION)