|
| 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 | +} |
0 commit comments