Skip to content

Commit e921530

Browse files
committed
add subType to bannerComponents
1 parent 650b87c commit e921530

2 files changed

Lines changed: 88 additions & 2 deletions

File tree

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

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,19 @@ public abstract class BannerComponents extends DirectionsJsonObject
7171

7272
/**
7373
* This view gives guidance through junctions and is used to complete maneuvers.
74-
*
75-
* @since 5.0.0
7674
*/
7775
public static final String GUIDANCE_VIEW = "guidance-view";
7876

77+
/**
78+
* This view gives guidance through signboards and is used to complete maneuvers.
79+
*/
80+
public static final String SIGNBOARD = "signboard";
81+
82+
/**
83+
* This view gives guidance through junctions and is used to complete maneuvers.
84+
*/
85+
public static final String JCT = "jct";
86+
7987
/**
8088
* Banner component types.
8189
* https://docs.mapbox.com/api/navigation/#banner-instruction-object
@@ -95,6 +103,19 @@ public abstract class BannerComponents extends DirectionsJsonObject
95103
public @interface BannerComponentsType {
96104
}
97105

106+
/**
107+
* Banner component types.
108+
* https://docs.mapbox.com/api/navigation/#banner-instruction-object
109+
*
110+
*/
111+
@Retention(RetentionPolicy.SOURCE)
112+
@StringDef( {
113+
JCT,
114+
SIGNBOARD
115+
})
116+
public @interface BannerComponentsSubType {
117+
}
118+
98119
/**
99120
* Create a new instance of this class by using the {@link Builder} class.
100121
*
@@ -137,6 +158,22 @@ public static Builder builder() {
137158
@BannerComponentsType
138159
public abstract String type();
139160

161+
/**
162+
* String giving you more context about {@link BannerComponentsType} which
163+
* may help in visual markup/display choices.
164+
* <p>
165+
* Possible values:
166+
* <ul>
167+
* <li><strong>jct</strong>: indicates a junction guidance view.</li>
168+
* <li><strong>signboard</strong>: indicates a signboard guidance view.</li>
169+
* </ul>
170+
*
171+
* @return String type from above list
172+
*/
173+
@Nullable
174+
@BannerComponentsType
175+
public abstract String subType();
176+
140177
/**
141178
* The abbreviated form of text.
142179
* <p>
@@ -316,6 +353,25 @@ public abstract static class Builder {
316353
public abstract Builder type(@NonNull @BannerComponentsType String type);
317354

318355

356+
357+
/**
358+
* String giving you more context about {@link BannerComponentsType}
359+
* which may help in visual markup/display choices.
360+
* <p>
361+
* Possible values:
362+
* <ul>
363+
* <li><strong>jct</strong>: indicates a junction guidance view.</li>
364+
* <li><strong>signboard</strong>: indicates a signboard guidance view.</li>
365+
* </ul>
366+
*
367+
* @param subType String subType from above list
368+
* @return String type from above list
369+
*/
370+
@NonNull
371+
@BannerComponentsType
372+
public abstract Builder subType(@Nullable @BannerComponentsSubType String subType);
373+
374+
319375
/**
320376
* The abbreviated form of text.
321377
*

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,4 +175,34 @@ public void testToFromJsonLaneText() {
175175

176176
assertEquals(bannerComponents, bannerComponentsFromJson);
177177
}
178+
179+
@Test
180+
public void testToFromJsonJctSubType() {
181+
182+
BannerComponents bannerComponents = BannerComponents.builder()
183+
.text("")
184+
.type("guidance-view")
185+
.subType("jct")
186+
.build();
187+
188+
String jsonString = bannerComponents.toJson();
189+
BannerComponents bannerComponentsFromJson = BannerComponents.fromJson(jsonString);
190+
191+
assertEquals(bannerComponents, bannerComponentsFromJson);
192+
}
193+
194+
@Test
195+
public void testToFromJsonSignboardSubType() {
196+
197+
BannerComponents bannerComponents = BannerComponents.builder()
198+
.text("")
199+
.type("guidance-view")
200+
.subType("signboard")
201+
.build();
202+
203+
String jsonString = bannerComponents.toJson();
204+
BannerComponents bannerComponentsFromJson = BannerComponents.fromJson(jsonString);
205+
206+
assertEquals(bannerComponents, bannerComponentsFromJson);
207+
}
178208
}

0 commit comments

Comments
 (0)