Skip to content

Commit 6fb9c7d

Browse files
committed
add active direction to banner component
1 parent d57c8cd commit 6fb9c7d

2 files changed

Lines changed: 45 additions & 0 deletions

File tree

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,20 @@ public static Builder builder() {
250250
@Nullable
251251
public abstract Boolean active();
252252

253+
/**
254+
* When components.active is set to true, this property shows which of the lane's
255+
* {@link BannerComponents#directions()} is applicable to the current route, when there is
256+
* more than one. For example, if a lane allows you to go left or straight but your current
257+
* route is guiding you to the left, then this value will be set to left.
258+
* See {@link BannerComponents#directions()} for possible values.
259+
* When {@link BannerComponents#active()} is false, this property will not be included in
260+
* the response. Only available on the mapbox/driving profile.
261+
* @return applicable lane direction.
262+
*/
263+
@Nullable
264+
@SerializedName("active_direction")
265+
public abstract String activeDirection();
266+
253267
/**
254268
* Convert the current {@link BannerComponents} to its builder holding the currently assigned
255269
* values. This allows you to modify a single property and then rebuild the object resulting in
@@ -442,6 +456,20 @@ public abstract static class Builder {
442456
*/
443457
public abstract Builder active(Boolean activeState);
444458

459+
/**
460+
* When components.active is set to true, this property shows which of the lane's
461+
* {@link BannerComponents#directions()} is applicable to the current route, when there is
462+
* more than one. For example, if a lane allows you to go left or straight but your current
463+
* route is guiding you to the left, then this value will be set to left.
464+
* See {@link BannerComponents#directions()} for possible values.
465+
* When {@link BannerComponents#active()} is false, this property will not be included in
466+
* the response. Only available on the mapbox/driving profile.
467+
*
468+
* @param activeDirection applicable lane direction.
469+
* @return this builder for chaining options together
470+
*/
471+
public abstract Builder activeDirection(String activeDirection);
472+
445473
/**
446474
* Build a new {@link BannerComponents} object.
447475
*

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,23 @@ public void testToFromJsonLaneType() {
145145
assertEquals(bannerComponents, bannerComponentsFromJson);
146146
}
147147

148+
@Test
149+
public void testToFromJsonActiveDirection() {
150+
151+
BannerComponents bannerComponents = BannerComponents.builder()
152+
.text("test")
153+
.type("lane")
154+
.activeDirection("left")
155+
.directions(Arrays.asList("left", "straight"))
156+
.active(true)
157+
.build();
158+
159+
String jsonString = bannerComponents.toJson();
160+
BannerComponents bannerComponentsFromJson = BannerComponents.fromJson(jsonString);
161+
162+
assertEquals(bannerComponents, bannerComponentsFromJson);
163+
}
164+
148165
@Test
149166
public void testToFromJsonLaneIcon() {
150167

0 commit comments

Comments
 (0)