Package com.azure.core.http.rest
Class RestProxy
java.lang.Object
com.azure.core.http.rest.RestProxy
- All Implemented Interfaces:
InvocationHandler
Type to create a proxy implementation for an interface describing REST API methods.
RestProxy can create proxy implementations for interfaces with methods that return deserialized Java objects as well as asynchronous Single objects that resolve to a deserialized Java object.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <A> A
Create a proxy implementation of the provided Swagger interface.static <A> A
create
(Class<A> swaggerInterface, HttpPipeline httpPipeline) Create a proxy implementation of the provided Swagger interface.static <A> A
create
(Class<A> swaggerInterface, HttpPipeline httpPipeline, SerializerAdapter serializer) Create a proxy implementation of the provided Swagger interface.send
(HttpRequest request, Context contextData) Send the provided request asynchronously, applying any request policies provided to the HttpClient instance.
-
Method Details
-
send
Send the provided request asynchronously, applying any request policies provided to the HttpClient instance.- Parameters:
request
- the HTTP request to sendcontextData
- the context- Returns:
- a
Mono
that emits HttpResponse asynchronously
-
invoke
- Specified by:
invoke
in interfaceInvocationHandler
-
create
Create a proxy implementation of the provided Swagger interface.- Type Parameters:
A
- the type of the Swagger interface- Parameters:
swaggerInterface
- the Swagger interface to provide a proxy implementation for- Returns:
- a proxy implementation of the provided Swagger interface
-
create
Create a proxy implementation of the provided Swagger interface.- Type Parameters:
A
- the type of the Swagger interface- Parameters:
swaggerInterface
- the Swagger interface to provide a proxy implementation forhttpPipeline
- the HttpPipelinePolicy and HttpClient pipeline that will be used to send Http requests- Returns:
- a proxy implementation of the provided Swagger interface
-
create
public static <A> A create(Class<A> swaggerInterface, HttpPipeline httpPipeline, SerializerAdapter serializer) Create a proxy implementation of the provided Swagger interface.- Type Parameters:
A
- the type of the Swagger interface.- Parameters:
swaggerInterface
- the Swagger interface to provide a proxy implementation forhttpPipeline
- the HttpPipelinePolicy and HttpClient pipline that will be used to send Http requestsserializer
- the serializer that will be used to convert POJOs to and from request and response bodies- Returns:
- a proxy implementation of the provided Swagger interface
-