Implement toShortString() for all result classes.

This commit is contained in:
Andreas Schildbach 2017-08-31 11:55:17 +02:00
parent d0e19dbd7a
commit fab11c0957
4 changed files with 29 additions and 0 deletions

View file

@ -59,4 +59,11 @@ public final class NearbyLocationsResult implements Serializable {
helper.add("size", locations.size()).add("locations", locations);
return helper.toString();
}
public String toShortString() {
if (status == Status.OK)
return locations.size() + " locations";
else
return status.toString();
}
}

View file

@ -68,4 +68,11 @@ public final class QueryDeparturesResult implements Serializable {
helper.add("size", stationDepartures.size()).add("stationDepartures", stationDepartures);
return helper.toString();
}
public String toShortString() {
if (status == Status.OK)
return stationDepartures.size() + " stationDepartures";
else
return status.toString();
}
}

View file

@ -113,4 +113,12 @@ public final class QueryTripsResult implements Serializable {
}
return helper.toString();
}
public String toShortString() {
if (status == Status.OK)
return trips.size() + " trips" + (from != null ? " from " + from : "") + (via != null ? " via " + via : "")
+ (to != null ? " to " + to : "");
else
return status.toString();
}
}

View file

@ -71,4 +71,11 @@ public final class SuggestLocationsResult implements Serializable {
helper.add("size", suggestedLocations.size()).add("suggestedLocations", suggestedLocations);
return helper.toString();
}
public String toShortString() {
if (status == Status.OK)
return suggestedLocations.size() + " locations";
else
return status.toString();
}
}