Skip to content

Commit

Permalink
experimental EV routing request and response parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasPaczos committed Feb 22, 2022
1 parent 93ba1bf commit e1b3f2f
Show file tree
Hide file tree
Showing 13 changed files with 969 additions and 26 deletions.
2 changes: 1 addition & 1 deletion config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

<!-- Checks for long source files. -->
<module name="FileLength">
<property name="max" value="2000"/>
<property name="max" value="2500"/>
</module>

<!-- Trailing spaces -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,4 +417,47 @@ private DirectionsCriteria() {
})
public @interface ApproachesCriteria {
}

// EXPERIMENTAL
/**
* Object representing experimental value.
* <p>
* All available experimental values are subject to change at any time.
*/
public static final String EXPERIMENTAL_ANNOTATION_STATE_OF_CHARGE = "state_of_charge";

/**
* Object representing experimental value.
* <p>
* All available experimental values are subject to change at any time.
*/
public static final String EXPERIMENTAL_ENGINE_ELECTRIC = "electric";

/**
* Object representing experimental value.
* <p>
* All available experimental values are subject to change at any time.
*/
public static final String EXPERIMENTAL_CONNECTOR_TYPE_CCS_COMBO_TYPE1 = "ccs_combo_type1";

/**
* Object representing experimental value.
* <p>
* All available experimental values are subject to change at any time.
*/
public static final String EXPERIMENTAL_CONNECTOR_TYPE_CCS_COMBO_TYPE2 = "ccs_combo_type2";

/**
* Object representing experimental value.
* <p>
* All available experimental values are subject to change at any time.
*/
public static final String EXPERIMENTAL_CONNECTOR_TYPE_TESLA = "tesla";

/**
* Object representing experimental value.
* <p>
* All available experimental values are subject to change at any time.
*/
public static final String EXPERIMENTAL_CONNECTOR_TYPE_MENNEKES_TYPE2 = "mennekes_type2";
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ public Point location() {
@Nullable
public abstract Double distance();

/**
* Object representing experimental value.
* <p>
* All available experimental values are subject to change at any time.
*/
@SerializedName("metadata")
@Nullable
public abstract ExperimentalWaypointMetadata experimentalMetadata();

/**
* Convert the current {@link DirectionsWaypoint} to its builder holding the currently assigned
* values. This allows you to modify a single property and then rebuild the object resulting in
Expand Down Expand Up @@ -111,6 +120,7 @@ public abstract static class Builder {
* @return this builder for chaining options together
* @since 3.0.0
*/
@NonNull
public abstract Builder name(@NonNull String name);

/**
Expand All @@ -125,6 +135,7 @@ public abstract static class Builder {
* @return this builder for chaining options together
* @since 3.0.0
*/
@NonNull
public abstract Builder rawLocation(@NonNull double[] rawLocation);

/**
Expand All @@ -133,9 +144,19 @@ public abstract static class Builder {
*
* @param distance distance from original requested location
*/
@Nullable
@NonNull
public abstract Builder distance(@Nullable Double distance);

/**
* Object representing experimental value.
* <p>
* All available experimental values are subject to change at any time.
*
* @param metadata metadata
*/
@NonNull
public abstract Builder experimentalMetadata(@Nullable ExperimentalWaypointMetadata metadata);

/**
* Build a new {@link DirectionsWaypoint} object.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
package com.mapbox.api.directions.v5.models;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.auto.value.AutoValue;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.SerializedName;
import com.mapbox.api.directions.v5.DirectionsAdapterFactory;

/**
* Object representing experimental value.
* <p>
* All available experimental values are subject to change at any time.
*/
@AutoValue
public abstract class ExperimentalWaypointMetadata extends DirectionsJsonObject {

/**
* Create a new instance of this class by using the {@link ExperimentalWaypointMetadata.Builder}
* class.
*
* @return {@link ExperimentalWaypointMetadata.Builder} for creating a new instance
*/
public static Builder builder() {
return new AutoValue_ExperimentalWaypointMetadata.Builder();
}

/**
* Object representing experimental value.
* <p>
* All available experimental values are subject to change at any time.
*/
@Nullable
@SerializedName("type")
public abstract String type();

/**
* Object representing experimental value.
* <p>
* All available experimental values are subject to change at any time.
*/
@Nullable
@SerializedName("name")
public abstract String name();

/**
* Object representing experimental value.
* <p>
* All available experimental values are subject to change at any time.
*/
@Nullable
@SerializedName("charge_time")
public abstract Integer chargeTime();

/**
* Object representing experimental value.
* <p>
* All available experimental values are subject to change at any time.
*/
@Nullable
@SerializedName("charge_to")
public abstract Integer chargeTo();

/**
* Object representing experimental value.
* <p>
* All available experimental values are subject to change at any time.
*/
@Nullable
@SerializedName("plug_type")
public abstract String plugType();

/**
* Object representing experimental value.
* <p>
* All available experimental values are subject to change at any time.
*/
@Nullable
@SerializedName("power_kw")
public abstract Integer powerKiloWatt();

/**
* Convert the current {@link ExperimentalWaypointMetadata} to its builder holding the currently
* assigned values. This allows you to modify a single property and then rebuild the object
* resulting in an updated and modified {@link ExperimentalWaypointMetadata}.
*
* @return a {@link ExperimentalWaypointMetadata.Builder} with the same values set to match
* the ones defined in this {@link ExperimentalWaypointMetadata}
*/
public abstract Builder toBuilder();

/**
* Gson type adapter for parsing Gson to this class.
*
* @param gson the built {@link Gson} object
* @return the type adapter for this class
*/
public static TypeAdapter<ExperimentalWaypointMetadata> typeAdapter(Gson gson) {
return new AutoValue_ExperimentalWaypointMetadata.GsonTypeAdapter(gson);
}

/**
* Create a new instance of this class by passing in a formatted valid JSON String.
*
* @param json a formatted valid JSON string defining a Metadata
* @return a new instance of this class defined by the values passed inside this static factory
* method
*/
public static ExperimentalWaypointMetadata fromJson(String json) {
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create());
return gson.create().fromJson(json, ExperimentalWaypointMetadata.class);
}

/**
* This builder can be used to set the values describing the {@link ExperimentalWaypointMetadata}.
*/
@AutoValue.Builder
public abstract static class Builder {

/**
* Object representing experimental value.
* <p>
* All available experimental values are subject to change at any time.
*
* @param type type
*/
@NonNull
public abstract Builder type(@Nullable String type);

/**
* Object representing experimental value.
* <p>
* All available experimental values are subject to change at any time.
*
@param name name
*/
@NonNull
public abstract Builder name(@Nullable String name);

/**
* Object representing experimental value.
* <p>
* All available experimental values are subject to change at any time.
*
@param chargeTime chargeTime
*/
@NonNull
public abstract Builder chargeTime(@Nullable Integer chargeTime);

/**
* Object representing experimental value.
* <p>
* All available experimental values are subject to change at any time.
*
@param chargeTo chargeTo
*/
@NonNull
public abstract Builder chargeTo(@Nullable Integer chargeTo);

/**
* Object representing experimental value.
* <p>
* All available experimental values are subject to change at any time.
*
@param plugType plugType
*/
@NonNull
public abstract Builder plugType(@Nullable String plugType);

/**
* Object representing experimental value.
* <p>
* All available experimental values are subject to change at any time.
*
@param powerKiloWatt powerKiloWatt
*/
@NonNull
public abstract Builder powerKiloWatt(@Nullable Integer powerKiloWatt);

/**
* Build a new {@link ExperimentalWaypointMetadata} object.
*
* @return a new {@link ExperimentalWaypointMetadata} using the provided values in this builder
*/
public abstract ExperimentalWaypointMetadata build();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mapbox.api.directions.v5.models;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.auto.value.AutoValue;
import com.google.gson.Gson;
Expand Down Expand Up @@ -92,6 +93,15 @@ public static Builder builder() {
@SerializedName("congestion_numeric")
public abstract List<Integer> congestionNumeric();

/**
* Object representing experimental value.
* <p>
* All available experimental values are subject to change at any time.
*/
@Nullable
@SerializedName("state_of_charge")
public abstract List<Integer> experimentalStateOfCharge();

/**
* Convert the current {@link LegAnnotation} to its builder holding the currently assigned
* values. This allows you to modify a single property and then rebuild the object resulting in
Expand Down Expand Up @@ -196,6 +206,17 @@ public abstract static class Builder {
*/
public abstract Builder congestionNumeric(@Nullable List<Integer> congestionNumeric);

/**
* Object representing experimental value.
* <p>
* All available experimental values are subject to change at any time.
*
* @param experimentalStateOfCharge experimentalStateOfCharge
*/
@NonNull
public abstract Builder experimentalStateOfCharge(
@Nullable List<Integer> experimentalStateOfCharge);

/**
* Build a new {@link LegAnnotation} object.
*
Expand Down
Loading

0 comments on commit e1b3f2f

Please sign in to comment.