|
| 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.mapbox.api.directions.v5.DirectionsAdapterFactory; |
| 10 | + |
| 11 | +/* |
| 12 | + * Payment method for the toll road. See `TollCost`, `PaymentsMethods`. |
| 13 | + */ |
| 14 | +@AutoValue |
| 15 | +@SuppressWarnings({"checkstyle:javadoctype", "checkstyle:javadocmethod"}) |
| 16 | +public abstract class CostPerVehicleSize extends DirectionsJsonObject { |
| 17 | + |
| 18 | + /* |
| 19 | + * Create a new instance of this class by using the `Builder` class. |
| 20 | + * |
| 21 | + * return this class's `Builder` for creating a new instance |
| 22 | + */ |
| 23 | + public static Builder builder() { |
| 24 | + return new AutoValue_CostPerVehicleSize.Builder(); |
| 25 | + } |
| 26 | + |
| 27 | + /* |
| 28 | + * Returns the toll cost for a small sized vehicle. |
| 29 | + * A toll cost of 0 is valid and simply means, "no toll costs are incurred for this route". |
| 30 | + * A toll cost of -1 indicates that the underlying data required |
| 31 | + * to compute the toll cost is not available. |
| 32 | + * |
| 33 | + * return toll cost |
| 34 | + */ |
| 35 | + @Nullable |
| 36 | + public abstract Double small(); |
| 37 | + |
| 38 | + /* |
| 39 | + * Returns the toll cost for a standard sized vehicle. |
| 40 | + * A toll cost of 0 is valid and simply means, "no toll costs are incurred for this route". |
| 41 | + * A toll cost of -1 indicates that the underlying data required |
| 42 | + * to compute the toll cost is not available. |
| 43 | + * |
| 44 | + * return toll cost |
| 45 | + */ |
| 46 | + @Nullable |
| 47 | + public abstract Double standard(); |
| 48 | + |
| 49 | + /* |
| 50 | + * Returns the toll cost for a middle sized vehicle. |
| 51 | + * A toll cost of 0 is valid and simply means, "no toll costs are incurred for this route". |
| 52 | + * A toll cost of -1 indicates that the underlying data required |
| 53 | + * to compute the toll cost is not available. |
| 54 | + * |
| 55 | + * return toll cost |
| 56 | + */ |
| 57 | + @Nullable |
| 58 | + public abstract Double middle(); |
| 59 | + |
| 60 | + /* |
| 61 | + * Returns the toll cost for a large sized vehicle. |
| 62 | + * A toll cost of 0 is valid and simply means, "no toll costs are incurred for this route". |
| 63 | + * A toll cost of -1 indicates that the underlying data required |
| 64 | + * to compute the toll cost is not available. |
| 65 | + * |
| 66 | + * return toll cost |
| 67 | + */ |
| 68 | + @Nullable |
| 69 | + public abstract Double large(); |
| 70 | + |
| 71 | + /* |
| 72 | + * Returns the toll cost for a jumbo sized vehicle. |
| 73 | + * A toll cost of 0 is valid and simply means, "no toll costs are incurred for this route". |
| 74 | + * A toll cost of -1 indicates that the underlying data required |
| 75 | + * to compute the toll cost is not available. |
| 76 | + * |
| 77 | + * return toll cost |
| 78 | + */ |
| 79 | + @Nullable |
| 80 | + public abstract Double jumbo(); |
| 81 | + |
| 82 | + /* |
| 83 | + * Convert the current `CostPerVehicleSize` to its builder holding the currently assigned |
| 84 | + * values. This allows you to modify a single property and then rebuild the object resulting in |
| 85 | + * an updated and modified `CostPerVehicleSize`. |
| 86 | + * |
| 87 | + * return a `Builder` with the same values set to match |
| 88 | + * the ones defined in this `CostPerVehicleSize` |
| 89 | + */ |
| 90 | + public abstract Builder toBuilder(); |
| 91 | + |
| 92 | + /* |
| 93 | + * Gson type adapter for parsing Gson to this class. |
| 94 | + * |
| 95 | + * param gson the built `Gson` object |
| 96 | + * return the type adapter for this class |
| 97 | + */ |
| 98 | + public static TypeAdapter<CostPerVehicleSize> typeAdapter(Gson gson) { |
| 99 | + return new AutoValue_CostPerVehicleSize.GsonTypeAdapter(gson); |
| 100 | + } |
| 101 | + |
| 102 | + /* |
| 103 | + * Create a new instance of this class by passing in a formatted valid JSON String. |
| 104 | + * |
| 105 | + * param json a formatted valid JSON string defining a CostPerVehicleSize |
| 106 | + * return a new instance of this class defined by the values passed inside this static factory |
| 107 | + * method |
| 108 | + */ |
| 109 | + public static CostPerVehicleSize fromJson(String json) { |
| 110 | + GsonBuilder gson = new GsonBuilder(); |
| 111 | + gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create()); |
| 112 | + return gson.create().fromJson(json, CostPerVehicleSize.class); |
| 113 | + } |
| 114 | + |
| 115 | + /* |
| 116 | + * This builder can be used to set the values describing the `CostPerVehicleSize`. |
| 117 | + */ |
| 118 | + @AutoValue.Builder |
| 119 | + @SuppressWarnings({"checkstyle:javadoctype", "checkstyle:javadocmethod"}) |
| 120 | + public abstract static class Builder |
| 121 | + extends DirectionsJsonObject.Builder<CostPerVehicleSize.Builder> { |
| 122 | + |
| 123 | + /* |
| 124 | + * Toll cost for a small sized vehicle. |
| 125 | + * A toll cost of 0 is valid and simply means, "no toll costs are incurred for this route". |
| 126 | + * A toll cost of -1 indicates that the underlying data required |
| 127 | + * to compute the toll cost is not available. |
| 128 | + * |
| 129 | + * param small toll cost |
| 130 | + * return this builder for chaining options together |
| 131 | + */ |
| 132 | + @NonNull |
| 133 | + public abstract Builder small(@Nullable Double small); |
| 134 | + |
| 135 | + /* |
| 136 | + * Toll cost for a standard sized vehicle. |
| 137 | + * A toll cost of 0 is valid and simply means, "no toll costs are incurred for this route". |
| 138 | + * A toll cost of -1 indicates that the underlying data required |
| 139 | + * to compute the toll cost is not available. |
| 140 | + * |
| 141 | + * param standard toll cost |
| 142 | + * return this builder for chaining options together |
| 143 | + */ |
| 144 | + @NonNull |
| 145 | + public abstract Builder standard(@Nullable Double standard); |
| 146 | + |
| 147 | + /* |
| 148 | + * Toll cost for a middle sized vehicle. |
| 149 | + * A toll cost of 0 is valid and simply means, "no toll costs are incurred for this route". |
| 150 | + * A toll cost of -1 indicates that the underlying data required |
| 151 | + * to compute the toll cost is not available. |
| 152 | + * |
| 153 | + * param middle toll cost |
| 154 | + * return this builder for chaining options together |
| 155 | + */ |
| 156 | + @NonNull |
| 157 | + public abstract Builder middle(@Nullable Double middle); |
| 158 | + |
| 159 | + /* |
| 160 | + * Toll cost for a large sized vehicle. |
| 161 | + * A toll cost of 0 is valid and simply means, "no toll costs are incurred for this route". |
| 162 | + * A toll cost of -1 indicates that the underlying data required |
| 163 | + * to compute the toll cost is not available. |
| 164 | + * |
| 165 | + * param large toll cost |
| 166 | + * return this builder for chaining options together |
| 167 | + */ |
| 168 | + @NonNull |
| 169 | + public abstract Builder large(@Nullable Double large); |
| 170 | + |
| 171 | + /* |
| 172 | + * Toll cost for a jumbo sized vehicle. |
| 173 | + * A toll cost of 0 is valid and simply means, "no toll costs are incurred for this route". |
| 174 | + * A toll cost of -1 indicates that the underlying data required |
| 175 | + * to compute the toll cost is not available. |
| 176 | + * |
| 177 | + * param jumbo toll cost |
| 178 | + * return this builder for chaining options together |
| 179 | + */ |
| 180 | + @NonNull |
| 181 | + public abstract Builder jumbo(@Nullable Double jumbo); |
| 182 | + |
| 183 | + /* |
| 184 | + * Build a new `CostPerVehicleSize` object. |
| 185 | + * |
| 186 | + * return a new `CostPerVehicleSize` using the provided values in this builder |
| 187 | + */ |
| 188 | + @NonNull |
| 189 | + public abstract CostPerVehicleSize build(); |
| 190 | + } |
| 191 | +} |
0 commit comments