Skip to content

Commit f50720f

Browse files
author
Langston Smith
authored
Updated annotations (#990)
1 parent 3e506e1 commit f50720f

4 files changed

Lines changed: 13 additions & 8 deletions

File tree

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

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

3+
import android.support.annotation.NonNull;
34
import android.support.annotation.Nullable;
45

56
import com.google.auto.value.AutoValue;
@@ -41,6 +42,7 @@ public static Builder builder() {
4142
* @return a single snippet of the full text instruction
4243
* @since 3.0.0
4344
*/
45+
@NonNull
4446
public abstract String text();
4547

4648
/**
@@ -61,6 +63,7 @@ public static Builder builder() {
6163
* @return String type from above list
6264
* @since 3.0.0
6365
*/
66+
@NonNull
6467
public abstract String type();
6568

6669
/**
@@ -205,7 +208,7 @@ public abstract static class Builder {
205208
* @return this builder for chaining options together
206209
* @since 3.0.0
207210
*/
208-
public abstract Builder text(String text);
211+
public abstract Builder text(@NonNull String text);
209212

210213
/**
211214
* String giving you more context about the component which may help in visual markup/display
@@ -227,7 +230,7 @@ public abstract static class Builder {
227230
* @return this builder for chaining options together
228231
* @since 3.0.0
229232
*/
230-
public abstract Builder type(String type);
233+
public abstract Builder type(@NonNull String type);
231234

232235

233236
/**

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

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

3+
import android.support.annotation.NonNull;
34
import android.support.annotation.Nullable;
45
import com.google.auto.value.AutoValue;
56
import com.google.gson.Gson;
@@ -45,7 +46,7 @@ public static Builder builder() {
4546
* information to the user
4647
* @since 3.0.0
4748
*/
48-
@Nullable
49+
@NonNull
4950
public abstract BannerText primary();
5051

5152
/**
@@ -132,7 +133,7 @@ public abstract static class Builder {
132133
* @return this builder for chaining options together
133134
* @since 3.0.0
134135
*/
135-
public abstract Builder primary(@Nullable BannerText primary);
136+
public abstract Builder primary(@NonNull BannerText primary);
136137

137138
/**
138139
* Ancillary visual information about the {@link LegStep}.

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

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

3+
import android.support.annotation.NonNull;
34
import android.support.annotation.Nullable;
45

56
import com.google.auto.value.AutoValue;
@@ -39,7 +40,7 @@ public static Builder builder() {
3940
* @return plain text with all the {@link BannerComponents} text items combined
4041
* @since 3.0.0
4142
*/
42-
@Nullable
43+
@NonNull
4344
public abstract String text();
4445

4546
/**
@@ -147,7 +148,7 @@ public abstract static class Builder {
147148
* @since 3.0.0
148149
*/
149150
@Nullable
150-
public abstract Builder text(String text);
151+
public abstract Builder text(@NonNull String text);
151152

152153
/**
153154
* A part or element of the {@link BannerInstructions}.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ public void sanity() throws Exception {
2929
public void testSerializable() throws Exception {
3030
BannerInstructions bannerInstructions = BannerInstructions.builder()
3131
.distanceAlongGeometry(100d)
32-
.primary(BannerText.builder().build())
33-
.secondary(BannerText.builder().build())
32+
.primary(BannerText.builder().text("Banner primary sample text").build())
33+
.secondary(BannerText.builder().text("Banner secondary sample text").build())
3434
.build();
3535
byte[] serialized = TestUtils.serialize(bannerInstructions);
3636
assertEquals(bannerInstructions, deserialize(serialized, BannerInstructions.class));

0 commit comments

Comments
 (0)