提交 e33324b7 编写于 作者: A Arjen Poutsma

Changed Future<Void> to Future<?>

Changed return values of Future<Void> to Future<?> in AsyncRestTemplate
and AsyncRestOperations.
上级 79ddba5d
......@@ -192,57 +192,63 @@ public interface AsyncRestOperations {
/**
* Create or update a resource by PUTting the given object to the URI.
* <p>URI Template variables are expanded using the given URI variables, if any.
* <p>The Future will return a {@code null} result upon completion.
* @param url the URL
* @param request the Object to be PUT, may be {@code null}
* @param uriVariables the variables to expand the template
* @see HttpEntity
*/
Future<Void> put(String url, HttpEntity<?> request, Object... uriVariables)
Future<?> put(String url, HttpEntity<?> request, Object... uriVariables)
throws RestClientException;
/**
* Creates a new resource by PUTting the given object to URI template.
* <p>URI Template variables are expanded using the given map.
* <p>The Future will return a {@code null} result upon completion.
* @param url the URL
* @param request the Object to be PUT, may be {@code null}
* @param uriVariables the variables to expand the template
* @see HttpEntity
*/
Future<Void> put(String url, HttpEntity<?> request, Map<String, ?> uriVariables)
Future<?> put(String url, HttpEntity<?> request, Map<String, ?> uriVariables)
throws RestClientException;
/**
* Creates a new resource by PUTting the given object to URL.
* <p>The Future will return a {@code null} result upon completion.
* @param url the URL
* @param request the Object to be PUT, may be {@code null}
* @see HttpEntity
*/
Future<Void> put(URI url, HttpEntity<?> request) throws RestClientException;
Future<?> put(URI url, HttpEntity<?> request) throws RestClientException;
// DELETE
/**
* Asynchronously delete the resources at the specified URI.
* <p>URI Template variables are expanded using the given URI variables, if any.
* <p>The Future will return a {@code null} result upon completion.
* @param url the URL
* @param uriVariables the variables to expand in the template
*/
Future<Void> delete(String url, Object... uriVariables) throws RestClientException;
Future<?> delete(String url, Object... uriVariables) throws RestClientException;
/**
* Asynchronously delete the resources at the specified URI.
* <p>URI Template variables are expanded using the given URI variables, if any.
* <p>The Future will return a {@code null} result upon completion.
* @param url the URL
* @param uriVariables the variables to expand in the template
*/
Future<Void> delete(String url, Map<String, ?> uriVariables) throws RestClientException;
Future<?> delete(String url, Map<String, ?> uriVariables) throws RestClientException;
/**
* Asynchronously delete the resources at the specified URI.
* <p>URI Template variables are expanded using the given URI variables, if any.
* <p>The Future will return a {@code null} result upon completion.
* @param url the URL
*/
Future<Void> delete(URI url) throws RestClientException;
Future<?> delete(URI url) throws RestClientException;
// OPTIONS
......
......@@ -304,21 +304,21 @@ public class AsyncRestTemplate extends AsyncHttpAccessor implements AsyncRestOpe
// PUT
@Override
public Future<Void> put(String url, HttpEntity<?> request, Object... uriVariables)
public Future<?> put(String url, HttpEntity<?> request, Object... uriVariables)
throws RestClientException {
AsyncRequestCallback requestCallback = httpEntityCallback(request);
return execute(url, HttpMethod.PUT, requestCallback, null, uriVariables);
}
@Override
public Future<Void> put(String url, HttpEntity<?> request,
public Future<?> put(String url, HttpEntity<?> request,
Map<String, ?> uriVariables) throws RestClientException {
AsyncRequestCallback requestCallback = httpEntityCallback(request);
return execute(url, HttpMethod.PUT, requestCallback, null, uriVariables);
}
@Override
public Future<Void> put(URI url, HttpEntity<?> request) throws RestClientException {
public Future<?> put(URI url, HttpEntity<?> request) throws RestClientException {
AsyncRequestCallback requestCallback = httpEntityCallback(request);
return execute(url, HttpMethod.PUT, requestCallback, null);
}
......@@ -326,19 +326,19 @@ public class AsyncRestTemplate extends AsyncHttpAccessor implements AsyncRestOpe
// DELETE
@Override
public Future<Void> delete(String url, Object... urlVariables)
public Future<?> delete(String url, Object... urlVariables)
throws RestClientException {
return execute(url, HttpMethod.DELETE, null, null, urlVariables);
}
@Override
public Future<Void> delete(String url, Map<String, ?> urlVariables)
public Future<?> delete(String url, Map<String, ?> urlVariables)
throws RestClientException {
return execute(url, HttpMethod.DELETE, null, null, urlVariables);
}
@Override
public Future<Void> delete(URI url) throws RestClientException {
public Future<?> delete(URI url) throws RestClientException {
return execute(url, HttpMethod.DELETE, null, null);
}
......
......@@ -149,7 +149,7 @@ public class AsyncRestTemplateIntegrationTests extends AbstractJettyServerTestCa
public void put()
throws URISyntaxException, ExecutionException, InterruptedException {
HttpEntity<String> requestEntity = new HttpEntity<>(helloWorld);
Future<Void>
Future<?>
responseEntityFuture = template.put(baseUrl + "/{method}", requestEntity,
"put");
responseEntityFuture.get();
......@@ -158,7 +158,7 @@ public class AsyncRestTemplateIntegrationTests extends AbstractJettyServerTestCa
@Test
public void delete()
throws URISyntaxException, ExecutionException, InterruptedException {
Future<Void> deletedFuture = template.delete(new URI(baseUrl + "/delete"));
Future<?> deletedFuture = template.delete(new URI(baseUrl + "/delete"));
deletedFuture.get();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册