Skip to content

Commit 7576641

Browse files
author
Łukasz Paczos
committed
updated nullability of Waypoint properties
1 parent 00801ea commit 7576641

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

services-directions-models/src/main/java/com/mapbox/api/directions/v5/models/DirectionsWaypoint.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.mapbox.api.directions.v5.models;
22

3-
import androidx.annotation.Nullable;
3+
import androidx.annotation.NonNull;
44
import com.google.auto.value.AutoValue;
55
import com.google.gson.Gson;
66
import com.google.gson.GsonBuilder;
@@ -33,7 +33,7 @@ public static Builder builder() {
3333
* @return string with the name of the way the coordinate snapped to
3434
* @since 1.0.0
3535
*/
36-
@Nullable
36+
@NonNull
3737
public abstract String name();
3838

3939
/**
@@ -42,7 +42,7 @@ public static Builder builder() {
4242
* @return GeoJson Point representing this waypoint location
4343
* @since 3.0.0
4444
*/
45-
@Nullable
45+
@NonNull
4646
public Point location() {
4747
return Point.fromLngLat(rawLocation()[0], rawLocation()[1]);
4848
}
@@ -53,7 +53,7 @@ public Point location() {
5353
* @return GeoJson Point representing this waypoint location
5454
* @since 3.0.0
5555
*/
56-
@Nullable
56+
@NonNull
5757
@SerializedName("location")
5858
@SuppressWarnings("mutable")
5959
abstract double[] rawLocation();
@@ -109,7 +109,7 @@ public abstract static class Builder {
109109
* @return this builder for chaining options together
110110
* @since 3.0.0
111111
*/
112-
public abstract Builder name(@Nullable String name);
112+
public abstract Builder name(@NonNull String name);
113113

114114
/**
115115
* The rawLocation as a double array. Once the {@link DirectionsWaypoint} objects created,
@@ -122,7 +122,7 @@ public abstract static class Builder {
122122
* @return this builder for chaining options together
123123
* @since 3.0.0
124124
*/
125-
public abstract Builder rawLocation(@Nullable double[] rawLocation);
125+
public abstract Builder rawLocation(@NonNull double[] rawLocation);
126126

127127
/**
128128
* Build a new {@link DirectionsWaypoint} object.

services-directions-models/src/test/java/com/mapbox/api/directions/v5/models/DirectionsWaypointTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,15 @@ public void tearDown() throws IOException {
7878
public void sanity() throws Exception {
7979
DirectionsWaypoint waypoint = DirectionsWaypoint.builder()
8080
.name("foobar")
81+
.rawLocation(new double[] {1.0, 2.0})
8182
.build();
8283
assertNotNull(waypoint);
8384
}
8485

8586
@Test
8687
public void location_doesGetConvertedToGeoJsonPoint() throws Exception {
8788
DirectionsWaypoint waypoint = DirectionsWaypoint.builder()
89+
.name("name")
8890
.rawLocation(new double[] {1.0, 2.0})
8991
.build();
9092
assertNotNull(waypoint.location());

0 commit comments

Comments
 (0)