Skip to content

Commit 8d9c4ef

Browse files
authored
Add step maneuver modifier constants (#1142)
Co-authored-by: Kyle Madsen <>
1 parent d9b3c1b commit 8d9c4ef

File tree

5 files changed

+93
-2
lines changed

5 files changed

+93
-2
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public static Builder builder() {
7171
* @since 3.0.0
7272
*/
7373
@Nullable
74+
@ManeuverModifier.Type
7475
public abstract String modifier();
7576

7677

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public static Builder builder() {
7070
* @since 5.0.0
7171
*/
7272
@Nullable
73+
@ManeuverModifier.Type
7374
public abstract String modifier();
7475

7576
/**
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
package com.mapbox.api.directions.v5.models;
2+
3+
import androidx.annotation.StringDef;
4+
5+
import java.lang.annotation.Retention;
6+
import java.lang.annotation.RetentionPolicy;
7+
8+
/**
9+
* Constants for the {@link StepManeuver#modifier()}.
10+
*
11+
* @since 5.2.0
12+
*/
13+
public final class ManeuverModifier {
14+
15+
/**
16+
* Indicates "uturn" maneuver modifier.
17+
*
18+
* @since 5.2.0
19+
*/
20+
public static final String UTURN = "uturn";
21+
22+
/**
23+
* Indicates "sharp right" maneuver modifier.
24+
*
25+
* @since 5.2.0
26+
*/
27+
public static final String SHARP_RIGHT = "sharp right";
28+
29+
/**
30+
* Indicates "right" maneuver modifier.
31+
*
32+
* @since 5.2.0
33+
*/
34+
public static final String RIGHT = "right";
35+
36+
/**
37+
* Indicates "slight right" maneuver modifier.
38+
*
39+
* @since 5.2.0
40+
*/
41+
public static final String SLIGHT_RIGHT = "slight right";
42+
43+
/**
44+
* Indicates "straight" maneuver modifier.
45+
*
46+
* @since 5.2.0
47+
*/
48+
public static final String STRAIGHT = "straight";
49+
50+
/**
51+
* Indicates "slight left" maneuver modifier.
52+
*
53+
* @since 5.2.0
54+
*/
55+
public static final String SLIGHT_LEFT = "slight left";
56+
57+
/**
58+
* Indicates "left" maneuver modifier.
59+
*
60+
* @since 5.2.0
61+
*/
62+
public static final String LEFT = "left";
63+
64+
/**
65+
* Indicates "sharp left" maneuver modifier.
66+
*
67+
* @since 5.2.0
68+
*/
69+
public static final String SHARP_LEFT = "sharp left";
70+
71+
/**
72+
* Representation of ManeuverModifier in form of logical types.
73+
*
74+
* @since 5.2.0
75+
*/
76+
@Retention(RetentionPolicy.SOURCE)
77+
@StringDef({
78+
ManeuverModifier.UTURN,
79+
ManeuverModifier.SHARP_RIGHT,
80+
ManeuverModifier.RIGHT,
81+
ManeuverModifier.SLIGHT_RIGHT,
82+
ManeuverModifier.STRAIGHT,
83+
ManeuverModifier.SLIGHT_LEFT,
84+
ManeuverModifier.LEFT,
85+
ManeuverModifier.SHARP_LEFT
86+
})
87+
@interface Type {
88+
}
89+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ public abstract Builder bearingAfter(
393393
* @return this builder for chaining options together
394394
* @since 3.0.0
395395
*/
396-
public abstract Builder modifier(@Nullable String modifier);
396+
public abstract Builder modifier(@Nullable @ManeuverModifier.Type String modifier);
397397

398398
/**
399399
* An optional integer indicating number of the exit to take. If exit is undefined the

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public void testToFromJson2() {
3838
StepManeuver stepManeuver = StepManeuver.builder()
3939
.rawLocation(new double[]{13.424671, 52.508812})
4040
.type("turn")
41-
.modifier("left")
41+
.modifier(ManeuverModifier.LEFT)
4242
.bearingBefore(299.0)
4343
.bearingAfter(202.0)
4444
.instruction("Turn left onto Adalbertstraße")

0 commit comments

Comments
 (0)