Skip to content

Commit 18d8941

Browse files
author
Łukasz Paczos
committed
added railway crossings to step intersection
1 parent a80b4b9 commit 18d8941

2 files changed

Lines changed: 36 additions & 7 deletions

File tree

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

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,15 @@ public Point location() {
205205
@SerializedName("tunnel_name")
206206
public abstract String tunnelName();
207207

208+
/**
209+
* Indicates whether there is a railway crossing at the intersection.
210+
*
211+
* @return whether there is a railway crossing at the intersection
212+
*/
213+
@Nullable
214+
@SerializedName("railway_crossing")
215+
public abstract Boolean railwayCrossing();
216+
208217
/**
209218
* Convert the current {@link StepIntersection} to its builder holding the currently assigned
210219
* values. This allows you to modify a single property and then rebuild the object resulting in
@@ -258,6 +267,7 @@ public abstract static class Builder {
258267
* @return this builder for chaining options together
259268
* @since 3.0.0
260269
*/
270+
@NonNull
261271
public abstract Builder bearings(@Nullable List<Integer> bearing);
262272

263273
/**
@@ -274,6 +284,7 @@ public abstract static class Builder {
274284
* @return this builder for chaining options together
275285
* @since 3.0.0
276286
*/
287+
@NonNull
277288
public abstract Builder classes(@Nullable List<String> classes);
278289

279290
/**
@@ -286,6 +297,7 @@ public abstract static class Builder {
286297
* @return this builder for chaining options together
287298
* @since 3.0.0
288299
*/
300+
@NonNull
289301
public abstract Builder entry(@Nullable List<Boolean> entry);
290302

291303
/**
@@ -299,6 +311,7 @@ public abstract static class Builder {
299311
* @return this builder for chaining options together
300312
* @since 3.0.0
301313
*/
314+
@NonNull
302315
public abstract Builder in(@Nullable Integer in);
303316

304317
/**
@@ -310,6 +323,7 @@ public abstract static class Builder {
310323
* @return this builder for chaining options together
311324
* @since 3.0.0
312325
*/
326+
@NonNull
313327
public abstract Builder out(@Nullable Integer out);
314328

315329
/**
@@ -322,6 +336,7 @@ public abstract static class Builder {
322336
* @return this builder for chaining options together
323337
* @since 3.0.0
324338
*/
339+
@NonNull
325340
public abstract Builder lanes(@Nullable List<IntersectionLanes> lanes);
326341

327342
/**
@@ -333,6 +348,7 @@ public abstract static class Builder {
333348
* @param geometryIndex index for the intersection
334349
* @return this builder for chaining options together
335350
*/
351+
@NonNull
336352
public abstract Builder geometryIndex(@Nullable Integer geometryIndex);
337353

338354
/**
@@ -343,7 +359,7 @@ public abstract static class Builder {
343359
* @param isUrban indicating whether the road exiting the intersection is in an urban area
344360
* @return this builder for chaining options together
345361
*/
346-
@Nullable
362+
@NonNull
347363
public abstract Builder isUrban(@Nullable Boolean isUrban);
348364

349365
/**
@@ -354,7 +370,7 @@ public abstract static class Builder {
354370
* @param adminIndex zero-based index into the admin list on the route leg for this intersection
355371
* @return this builder for chaining options together
356372
*/
357-
@Nullable
373+
@NonNull
358374
public abstract Builder adminIndex(@Nullable Integer adminIndex);
359375

360376
/**
@@ -364,7 +380,7 @@ public abstract static class Builder {
364380
* @param restStop object containing information about passing rest stops along the route.
365381
* @return this builder for chaining options together
366382
*/
367-
@Nullable
383+
@NonNull
368384
public abstract Builder restStop(@Nullable RestStop restStop);
369385

370386
/**
@@ -378,7 +394,7 @@ public abstract static class Builder {
378394
* a toll collection point along the route.
379395
* @return this builder for chaining options together
380396
*/
381-
@Nullable
397+
@NonNull
382398
public abstract Builder tollCollection(@Nullable TollCollection tollCollection);
383399

384400
/**
@@ -389,7 +405,7 @@ public abstract static class Builder {
389405
* @param street an object containing detailed road information.
390406
* @return this builder for chaining options together
391407
*/
392-
@Nullable
408+
@NonNull
393409
public abstract Builder mapboxStreetsV8(@Nullable MapboxStreetsV8 street);
394410

395411
/**
@@ -398,8 +414,18 @@ public abstract static class Builder {
398414
* @param tunnelName name of the tunnel
399415
* @return this builder for chaining options together
400416
*/
417+
@NonNull
401418
public abstract Builder tunnelName(@Nullable String tunnelName);
402419

420+
/**
421+
* Indicates whether there is a railway crossing at the intersection.
422+
*
423+
* @param railwayCrossing whether there is a railway crossing at the intersection.
424+
* @return this builder for chaining options together
425+
*/
426+
@NonNull
427+
public abstract Builder railwayCrossing(@Nullable Boolean railwayCrossing);
428+
403429
/**
404430
* The rawLocation as a double array. Once the {@link StepIntersection} object's created,
405431
* this raw location gets converted into a {@link Point} object and is public exposed as such.
@@ -411,6 +437,7 @@ public abstract static class Builder {
411437
* @return this builder for chaining options together
412438
* @since 3.0.0
413439
*/
440+
@NonNull
414441
public abstract Builder rawLocation(@NonNull double[] rawLocation);
415442

416443
/**
@@ -419,6 +446,7 @@ public abstract static class Builder {
419446
* @return a new {@link StepIntersection} using the provided values in this builder
420447
* @since 3.0.0
421448
*/
449+
@NonNull
422450
public abstract StepIntersection build();
423451
}
424452
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ public void testToFromJson2() {
7777
assertEquals(intersection, intersectionFromJson);
7878
}
7979

80-
8180
@Test
8281
public void testFromJson() {
8382
String stepIntersectionJsonString = "{"
@@ -88,14 +87,16 @@ public void testFromJson() {
8887
+ "\"geometry_index\": 123,"
8988
+ "\"is_urban\": true,"
9089
+ "\"mapbox_streets_v8\": {\"class\": \"street\"},"
91-
+ "\"tunnel_name\": \"test tunnel name\""
90+
+ "\"tunnel_name\": \"test tunnel name\","
91+
+ "\"railway_crossing\": true"
9292
+ "}";
9393

9494
StepIntersection stepIntersection = StepIntersection.fromJson(stepIntersectionJsonString);
9595
assertEquals(123, stepIntersection.geometryIndex().intValue());
9696
assertTrue(stepIntersection.isUrban());
9797
assertEquals("street", stepIntersection.mapboxStreetsV8().roadClass());
9898
assertEquals("test tunnel name", stepIntersection.tunnelName());
99+
assertTrue(stepIntersection.railwayCrossing());
99100

100101
Point location = stepIntersection.location();
101102
assertEquals(13.426579, location.longitude(), 0.0001);

0 commit comments

Comments
 (0)