com.route4me.sdk.RequestMethod Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of route4me-java-sdk Show documentation
Show all versions of route4me-java-sdk Show documentation
>This SDK makes it easier for you use the Route4Me API, which creates optimally sequenced driving routes for many drivers.
package com.route4me.sdk;
import com.route4me.sdk.http.HttpDeleteWithBody;
import java.lang.reflect.InvocationTargetException;
import java.net.URI;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.client.methods.HttpRequestBase;
public enum RequestMethod {
GET(HttpGet.class), POST(HttpPost.class), DELETE(HttpDeleteWithBody.class), PUT(HttpPut.class);
private final Class extends HttpRequestBase> clazz;
RequestMethod(Class extends HttpRequestBase> clazz) {
this.clazz = clazz;
}
public HttpRequestBase create(URI uri) {
try {
return this.clazz.getConstructor(URI.class).newInstance(uri);
} catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
//(almost) unreachable path
throw new RuntimeException(ex);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy