Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public static Builder builder() {
* @since 3.0.0
*/
@Nullable
@ManeuverModifier.Type
public abstract String modifier();


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public static Builder builder() {
* @since 5.0.0
*/
@Nullable
@ManeuverModifier.Type
public abstract String modifier();

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package com.mapbox.api.directions.v5.models;

import androidx.annotation.StringDef;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
* Constants for the {@link StepManeuver#modifier()}.
*
* @since 5.2.0
*/
public final class ManeuverModifier {

/**
* Indicates "uturn" maneuver modifier.
*
* @since 5.2.0
*/
public static final String UTURN = "uturn";

/**
* Indicates "sharp right" maneuver modifier.
*
* @since 5.2.0
*/
public static final String SHARP_RIGHT = "sharp right";

/**
* Indicates "right" maneuver modifier.
*
* @since 5.2.0
*/
public static final String RIGHT = "right";

/**
* Indicates "slight right" maneuver modifier.
*
* @since 5.2.0
*/
public static final String SLIGHT_RIGHT = "slight right";

/**
* Indicates "straight" maneuver modifier.
*
* @since 5.2.0
*/
public static final String STRAIGHT = "straight";

/**
* Indicates "slight left" maneuver modifier.
*
* @since 5.2.0
*/
public static final String SLIGHT_LEFT = "slight left";

/**
* Indicates "left" maneuver modifier.
*
* @since 5.2.0
*/
public static final String LEFT = "left";

/**
* Indicates "sharp left" maneuver modifier.
*
* @since 5.2.0
*/
public static final String SHARP_LEFT = "sharp left";

/**
* Representation of ManeuverModifier in form of logical types.
*
* @since 5.2.0
*/
@Retention(RetentionPolicy.SOURCE)
@StringDef({
ManeuverModifier.UTURN,
ManeuverModifier.SHARP_RIGHT,
ManeuverModifier.RIGHT,
ManeuverModifier.SLIGHT_RIGHT,
ManeuverModifier.STRAIGHT,
ManeuverModifier.SLIGHT_LEFT,
ManeuverModifier.LEFT,
ManeuverModifier.SHARP_LEFT
})
@interface Type {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arghh this needs to be public Java... 🤦

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh java

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ public abstract Builder bearingAfter(
* @return this builder for chaining options together
* @since 3.0.0
*/
public abstract Builder modifier(@Nullable String modifier);
public abstract Builder modifier(@Nullable @ManeuverModifier.Type String modifier);

/**
* An optional integer indicating number of the exit to take. If exit is undefined the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void testToFromJson2() {
StepManeuver stepManeuver = StepManeuver.builder()
.rawLocation(new double[]{13.424671, 52.508812})
.type("turn")
.modifier("left")
.modifier(ManeuverModifier.LEFT)
.bearingBefore(299.0)
.bearingAfter(202.0)
.instruction("Turn left onto Adalbertstraße")
Expand Down