mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-07 05:58:46 +00:00
Location: add asserts for the coordinate accessors
This commit is contained in:
parent
3717814744
commit
8903d86590
1 changed files with 5 additions and 0 deletions
|
@ -19,6 +19,7 @@ package de.schildbach.pte.dto;
|
|||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
|
@ -97,18 +98,22 @@ public final class Location implements Serializable {
|
|||
}
|
||||
|
||||
public double getLatAsDouble() {
|
||||
checkState(hasCoord(), "missing coordinates: %s", toString());
|
||||
return coord.getLatAsDouble();
|
||||
}
|
||||
|
||||
public double getLonAsDouble() {
|
||||
checkState(hasCoord(), "missing coordinates: %s", toString());
|
||||
return coord.getLonAsDouble();
|
||||
}
|
||||
|
||||
public int getLatAs1E6() {
|
||||
checkState(hasCoord(), "missing coordinates: %s", toString());
|
||||
return coord.getLatAs1E6();
|
||||
}
|
||||
|
||||
public int getLonAs1E6() {
|
||||
checkState(hasCoord(), "missing coordinates: %s", toString());
|
||||
return coord.getLonAs1E6();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue