3939 *
4040 * @see <a href="https://www.mapbox.com/api-documentation/?language=Java#distance">Mapbox Distance API documentation</a>
4141 * @since 2.0.0
42+ * @deprecated replace by the Directions Matrix API.
4243 */
44+ @ Deprecated
4345public class MapboxDistance extends MapboxService <DistanceResponse > {
4446
4547 protected Builder builder = null ;
4648 private DistanceService service = null ;
4749 private Call <DistanceResponse > call = null ;
4850 private Gson gson ;
4951
52+ @ Deprecated
5053 protected MapboxDistance (Builder builder ) {
5154 this .builder = builder ;
5255 }
5356
57+ @ Deprecated
5458 protected Gson getGson () {
5559 // Gson instance with type adapters
5660 if (gson == null ) {
@@ -62,6 +66,7 @@ protected Gson getGson() {
6266 return gson ;
6367 }
6468
69+ @ Deprecated
6570 private DistanceService getService () {
6671 //No need to recreate it
6772 if (service != null ) {
@@ -88,7 +93,9 @@ private DistanceService getService() {
8893 *
8994 * @return call
9095 * @since 2.0.0
96+ * @deprecated replace by the Directions Matrix API.
9197 */
98+ @ Deprecated
9299 public Call <DistanceResponse > getCall () {
93100 // No need to recreate it
94101 if (call != null ) {
@@ -112,7 +119,9 @@ public Call<DistanceResponse> getCall() {
112119 * @return The distance v1 response.
113120 * @throws IOException Signals that an I/O exception of some sort has occurred.
114121 * @since 2.0.0
122+ * @deprecated replace by the Directions Matrix API.
115123 */
124+ @ Deprecated
116125 @ Override
117126 public Response <DistanceResponse > executeCall () throws IOException {
118127 return getCall ().execute ();
@@ -123,7 +132,9 @@ public Response<DistanceResponse> executeCall() throws IOException {
123132 *
124133 * @param callback A Retrofit callback.
125134 * @since 2.0.0
135+ * @deprecated replace by the Directions Matrix API.
126136 */
137+ @ Deprecated
127138 @ Override
128139 public void enqueueCall (Callback <DistanceResponse > callback ) {
129140 getCall ().enqueue (callback );
@@ -133,7 +144,9 @@ public void enqueueCall(Callback<DistanceResponse> callback) {
133144 * Cancel the call
134145 *
135146 * @since 2.0.0
147+ * @deprecated replace by the Directions Matrix API.
136148 */
149+ @ Deprecated
137150 @ Override
138151 public void cancelCall () {
139152 getCall ().cancel ();
@@ -144,7 +157,9 @@ public void cancelCall() {
144157 *
145158 * @return cloned call
146159 * @since 2.0.0
160+ * @deprecated replace by the Directions Matrix API.
147161 */
162+ @ Deprecated
148163 @ Override
149164 public Call <DistanceResponse > cloneCall () {
150165 return getCall ().clone ();
@@ -154,7 +169,9 @@ public Call<DistanceResponse> cloneCall() {
154169 * Builds your distance query by adding parameters.
155170 *
156171 * @since 2.0.0
172+ * @deprecated replace by the Directions Matrix API.
157173 */
174+ @ Deprecated
158175 public static class Builder <T extends Builder > extends MapboxBuilder {
159176
160177 private String accessToken ;
@@ -167,7 +184,9 @@ public static class Builder<T extends Builder> extends MapboxBuilder {
167184 * Constructor
168185 *
169186 * @since 2.0.0
187+ * @deprecated replace by the Directions Matrix API.
170188 */
189+ @ Deprecated
171190 public Builder () {
172191 }
173192
@@ -176,7 +195,9 @@ public Builder() {
176195 * {@link DirectionsCriteria#PROFILE_DEFAULT_USER}.
177196 * @return Builder
178197 * @since 2.0.0
198+ * @deprecated replace by the Directions Matrix API.
179199 */
200+ @ Deprecated
180201 public T setUser (String user ) {
181202 this .user = user ;
182203 return (T ) this ;
@@ -185,7 +206,9 @@ public T setUser(String user) {
185206 /**
186207 * @return the user as String.
187208 * @since 2.0.0
209+ * @deprecated replace by the Directions Matrix API.
188210 */
211+ @ Deprecated
189212 public String getUser () {
190213 return user ;
191214 }
@@ -199,7 +222,9 @@ public String getUser() {
199222 * {@link DirectionsCriteria} constants.
200223 * @return Builder
201224 * @since 2.0.0
225+ * @deprecated replace by the Directions Matrix API.
202226 */
227+ @ Deprecated
203228 public T setProfile (String profile ) {
204229 this .profile = profile ;
205230 return (T ) this ;
@@ -209,7 +234,9 @@ public T setProfile(String profile) {
209234 * @return String containing A directions profile ID; either {@code driving},
210235 * {@code walking}, or {@code cycling}.
211236 * @since 2.0.0
237+ * @deprecated replace by the Directions Matrix API.
212238 */
239+ @ Deprecated
213240 public String getProfile () {
214241 return profile ;
215242 }
@@ -220,11 +247,13 @@ public RequestBody getCoordinates() {
220247 MultiPoint .fromCoordinates (coordinates ).toJson ());
221248 }
222249
250+ @ Deprecated
223251 public T setCoordinates (List <Position > coordinates ) {
224252 this .coordinates = coordinates ;
225253 return (T ) this ;
226254 }
227255
256+ @ Deprecated
228257 private void validateProfile () throws ServicesException {
229258 if (profile == null || !(profile .equals (DirectionsCriteria .PROFILE_CYCLING )
230259 || profile .equals (DirectionsCriteria .PROFILE_DRIVING )
@@ -234,6 +263,7 @@ private void validateProfile() throws ServicesException {
234263 }
235264 }
236265
266+ @ Deprecated
237267 private void validateTrace () throws ServicesException {
238268 if (coordinates == null || coordinates .size () <= 0 ) {
239269 throw new ServicesException ("Using Mapbox Distance API requires to set some coordinates." );
@@ -252,7 +282,9 @@ private void validateTrace() throws ServicesException {
252282 * this API.
253283 * @return Builder
254284 * @since 2.0.0
285+ * @deprecated replace by the Directions Matrix API.
255286 */
287+ @ Deprecated
256288 @ Override
257289 public T setAccessToken (String accessToken ) {
258290 this .accessToken = accessToken ;
@@ -262,7 +294,9 @@ public T setAccessToken(String accessToken) {
262294 /**
263295 * @return Mapbox access token
264296 * @since 2.0.0
297+ * @deprecated replace by the Directions Matrix API.
265298 */
299+ @ Deprecated
266300 @ Override
267301 public String getAccessToken () {
268302 return this .accessToken ;
@@ -279,7 +313,9 @@ public T setClientAppName(String appName) {
279313 * @param baseUrl base url used as end point
280314 * @return Builder
281315 * @since 2.0.0
316+ * @deprecated replace by the Directions Matrix API.
282317 */
318+ @ Deprecated
283319 @ Override
284320 public T setBaseUrl (String baseUrl ) {
285321 super .baseUrl = baseUrl ;
@@ -293,7 +329,9 @@ public T setBaseUrl(String baseUrl) {
293329 * @throws ServicesException Generic Exception occurring when something with the Distance
294330 * API goes wrong.
295331 * @since 2.0.0
332+ * @deprecated replace by the Directions Matrix API.
296333 */
334+ @ Deprecated
297335 @ Override
298336 public MapboxDistance build () throws ServicesException {
299337 validateAccessToken (accessToken );
0 commit comments