Skip to content

Commit e1b3f2f

Browse files
author
Łukasz Paczos
committed
experimental EV routing request and response parameters
1 parent 93ba1bf commit e1b3f2f

13 files changed

Lines changed: 969 additions & 26 deletions

File tree

config/checkstyle/checkstyle.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
<!-- Checks for long source files. -->
3434
<module name="FileLength">
35-
<property name="max" value="2000"/>
35+
<property name="max" value="2500"/>
3636
</module>
3737

3838
<!-- Trailing spaces -->

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

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,4 +417,47 @@ private DirectionsCriteria() {
417417
})
418418
public @interface ApproachesCriteria {
419419
}
420+
421+
// EXPERIMENTAL
422+
/**
423+
* Object representing experimental value.
424+
* <p>
425+
* All available experimental values are subject to change at any time.
426+
*/
427+
public static final String EXPERIMENTAL_ANNOTATION_STATE_OF_CHARGE = "state_of_charge";
428+
429+
/**
430+
* Object representing experimental value.
431+
* <p>
432+
* All available experimental values are subject to change at any time.
433+
*/
434+
public static final String EXPERIMENTAL_ENGINE_ELECTRIC = "electric";
435+
436+
/**
437+
* Object representing experimental value.
438+
* <p>
439+
* All available experimental values are subject to change at any time.
440+
*/
441+
public static final String EXPERIMENTAL_CONNECTOR_TYPE_CCS_COMBO_TYPE1 = "ccs_combo_type1";
442+
443+
/**
444+
* Object representing experimental value.
445+
* <p>
446+
* All available experimental values are subject to change at any time.
447+
*/
448+
public static final String EXPERIMENTAL_CONNECTOR_TYPE_CCS_COMBO_TYPE2 = "ccs_combo_type2";
449+
450+
/**
451+
* Object representing experimental value.
452+
* <p>
453+
* All available experimental values are subject to change at any time.
454+
*/
455+
public static final String EXPERIMENTAL_CONNECTOR_TYPE_TESLA = "tesla";
456+
457+
/**
458+
* Object representing experimental value.
459+
* <p>
460+
* All available experimental values are subject to change at any time.
461+
*/
462+
public static final String EXPERIMENTAL_CONNECTOR_TYPE_MENNEKES_TYPE2 = "mennekes_type2";
420463
}

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

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ public Point location() {
6060
@Nullable
6161
public abstract Double distance();
6262

63+
/**
64+
* Object representing experimental value.
65+
* <p>
66+
* All available experimental values are subject to change at any time.
67+
*/
68+
@SerializedName("metadata")
69+
@Nullable
70+
public abstract ExperimentalWaypointMetadata experimentalMetadata();
71+
6372
/**
6473
* Convert the current {@link DirectionsWaypoint} to its builder holding the currently assigned
6574
* values. This allows you to modify a single property and then rebuild the object resulting in
@@ -111,6 +120,7 @@ public abstract static class Builder {
111120
* @return this builder for chaining options together
112121
* @since 3.0.0
113122
*/
123+
@NonNull
114124
public abstract Builder name(@NonNull String name);
115125

116126
/**
@@ -125,6 +135,7 @@ public abstract static class Builder {
125135
* @return this builder for chaining options together
126136
* @since 3.0.0
127137
*/
138+
@NonNull
128139
public abstract Builder rawLocation(@NonNull double[] rawLocation);
129140

130141
/**
@@ -133,9 +144,19 @@ public abstract static class Builder {
133144
*
134145
* @param distance distance from original requested location
135146
*/
136-
@Nullable
147+
@NonNull
137148
public abstract Builder distance(@Nullable Double distance);
138149

150+
/**
151+
* Object representing experimental value.
152+
* <p>
153+
* All available experimental values are subject to change at any time.
154+
*
155+
* @param metadata metadata
156+
*/
157+
@NonNull
158+
public abstract Builder experimentalMetadata(@Nullable ExperimentalWaypointMetadata metadata);
159+
139160
/**
140161
* Build a new {@link DirectionsWaypoint} object.
141162
*
Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
package com.mapbox.api.directions.v5.models;
2+
3+
import androidx.annotation.NonNull;
4+
import androidx.annotation.Nullable;
5+
import com.google.auto.value.AutoValue;
6+
import com.google.gson.Gson;
7+
import com.google.gson.GsonBuilder;
8+
import com.google.gson.TypeAdapter;
9+
import com.google.gson.annotations.SerializedName;
10+
import com.mapbox.api.directions.v5.DirectionsAdapterFactory;
11+
12+
/**
13+
* Object representing experimental value.
14+
* <p>
15+
* All available experimental values are subject to change at any time.
16+
*/
17+
@AutoValue
18+
public abstract class ExperimentalWaypointMetadata extends DirectionsJsonObject {
19+
20+
/**
21+
* Create a new instance of this class by using the {@link ExperimentalWaypointMetadata.Builder}
22+
* class.
23+
*
24+
* @return {@link ExperimentalWaypointMetadata.Builder} for creating a new instance
25+
*/
26+
public static Builder builder() {
27+
return new AutoValue_ExperimentalWaypointMetadata.Builder();
28+
}
29+
30+
/**
31+
* Object representing experimental value.
32+
* <p>
33+
* All available experimental values are subject to change at any time.
34+
*/
35+
@Nullable
36+
@SerializedName("type")
37+
public abstract String type();
38+
39+
/**
40+
* Object representing experimental value.
41+
* <p>
42+
* All available experimental values are subject to change at any time.
43+
*/
44+
@Nullable
45+
@SerializedName("name")
46+
public abstract String name();
47+
48+
/**
49+
* Object representing experimental value.
50+
* <p>
51+
* All available experimental values are subject to change at any time.
52+
*/
53+
@Nullable
54+
@SerializedName("charge_time")
55+
public abstract Integer chargeTime();
56+
57+
/**
58+
* Object representing experimental value.
59+
* <p>
60+
* All available experimental values are subject to change at any time.
61+
*/
62+
@Nullable
63+
@SerializedName("charge_to")
64+
public abstract Integer chargeTo();
65+
66+
/**
67+
* Object representing experimental value.
68+
* <p>
69+
* All available experimental values are subject to change at any time.
70+
*/
71+
@Nullable
72+
@SerializedName("plug_type")
73+
public abstract String plugType();
74+
75+
/**
76+
* Object representing experimental value.
77+
* <p>
78+
* All available experimental values are subject to change at any time.
79+
*/
80+
@Nullable
81+
@SerializedName("power_kw")
82+
public abstract Integer powerKiloWatt();
83+
84+
/**
85+
* Convert the current {@link ExperimentalWaypointMetadata} to its builder holding the currently
86+
* assigned values. This allows you to modify a single property and then rebuild the object
87+
* resulting in an updated and modified {@link ExperimentalWaypointMetadata}.
88+
*
89+
* @return a {@link ExperimentalWaypointMetadata.Builder} with the same values set to match
90+
* the ones defined in this {@link ExperimentalWaypointMetadata}
91+
*/
92+
public abstract Builder toBuilder();
93+
94+
/**
95+
* Gson type adapter for parsing Gson to this class.
96+
*
97+
* @param gson the built {@link Gson} object
98+
* @return the type adapter for this class
99+
*/
100+
public static TypeAdapter<ExperimentalWaypointMetadata> typeAdapter(Gson gson) {
101+
return new AutoValue_ExperimentalWaypointMetadata.GsonTypeAdapter(gson);
102+
}
103+
104+
/**
105+
* Create a new instance of this class by passing in a formatted valid JSON String.
106+
*
107+
* @param json a formatted valid JSON string defining a Metadata
108+
* @return a new instance of this class defined by the values passed inside this static factory
109+
* method
110+
*/
111+
public static ExperimentalWaypointMetadata fromJson(String json) {
112+
GsonBuilder gson = new GsonBuilder();
113+
gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create());
114+
return gson.create().fromJson(json, ExperimentalWaypointMetadata.class);
115+
}
116+
117+
/**
118+
* This builder can be used to set the values describing the {@link ExperimentalWaypointMetadata}.
119+
*/
120+
@AutoValue.Builder
121+
public abstract static class Builder {
122+
123+
/**
124+
* Object representing experimental value.
125+
* <p>
126+
* All available experimental values are subject to change at any time.
127+
*
128+
* @param type type
129+
*/
130+
@NonNull
131+
public abstract Builder type(@Nullable String type);
132+
133+
/**
134+
* Object representing experimental value.
135+
* <p>
136+
* All available experimental values are subject to change at any time.
137+
*
138+
@param name name
139+
*/
140+
@NonNull
141+
public abstract Builder name(@Nullable String name);
142+
143+
/**
144+
* Object representing experimental value.
145+
* <p>
146+
* All available experimental values are subject to change at any time.
147+
*
148+
@param chargeTime chargeTime
149+
*/
150+
@NonNull
151+
public abstract Builder chargeTime(@Nullable Integer chargeTime);
152+
153+
/**
154+
* Object representing experimental value.
155+
* <p>
156+
* All available experimental values are subject to change at any time.
157+
*
158+
@param chargeTo chargeTo
159+
*/
160+
@NonNull
161+
public abstract Builder chargeTo(@Nullable Integer chargeTo);
162+
163+
/**
164+
* Object representing experimental value.
165+
* <p>
166+
* All available experimental values are subject to change at any time.
167+
*
168+
@param plugType plugType
169+
*/
170+
@NonNull
171+
public abstract Builder plugType(@Nullable String plugType);
172+
173+
/**
174+
* Object representing experimental value.
175+
* <p>
176+
* All available experimental values are subject to change at any time.
177+
*
178+
@param powerKiloWatt powerKiloWatt
179+
*/
180+
@NonNull
181+
public abstract Builder powerKiloWatt(@Nullable Integer powerKiloWatt);
182+
183+
/**
184+
* Build a new {@link ExperimentalWaypointMetadata} object.
185+
*
186+
* @return a new {@link ExperimentalWaypointMetadata} using the provided values in this builder
187+
*/
188+
public abstract ExperimentalWaypointMetadata build();
189+
}
190+
}

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.mapbox.api.directions.v5.models;
22

3+
import androidx.annotation.NonNull;
34
import androidx.annotation.Nullable;
45
import com.google.auto.value.AutoValue;
56
import com.google.gson.Gson;
@@ -92,6 +93,15 @@ public static Builder builder() {
9293
@SerializedName("congestion_numeric")
9394
public abstract List<Integer> congestionNumeric();
9495

96+
/**
97+
* Object representing experimental value.
98+
* <p>
99+
* All available experimental values are subject to change at any time.
100+
*/
101+
@Nullable
102+
@SerializedName("state_of_charge")
103+
public abstract List<Integer> experimentalStateOfCharge();
104+
95105
/**
96106
* Convert the current {@link LegAnnotation} to its builder holding the currently assigned
97107
* values. This allows you to modify a single property and then rebuild the object resulting in
@@ -196,6 +206,17 @@ public abstract static class Builder {
196206
*/
197207
public abstract Builder congestionNumeric(@Nullable List<Integer> congestionNumeric);
198208

209+
/**
210+
* Object representing experimental value.
211+
* <p>
212+
* All available experimental values are subject to change at any time.
213+
*
214+
* @param experimentalStateOfCharge experimentalStateOfCharge
215+
*/
216+
@NonNull
217+
public abstract Builder experimentalStateOfCharge(
218+
@Nullable List<Integer> experimentalStateOfCharge);
219+
199220
/**
200221
* Build a new {@link LegAnnotation} object.
201222
*

0 commit comments

Comments
 (0)