retrofit/src/main/java/retrofit2/Retrofit.java
@SuppressWarnings("unchecked") // Single-interface proxy creation guarded by parameter safety.
  public <T> T create(final Class<T> service) {
    Utils.validateServiceInterface(service);
    if (validateEagerly) {
      eagerlyValidateMethods(service);
    }
    return (T) Proxy.newProxyInstance(service.getClassLoader(), new Class<?>[] { service },
        new InvocationHandler() {
          private final Platform platform = Platform.get();
          private final Object[] emptyArgs = new Object[0];

          @Override public @Nullable Object invoke(Object proxy, Method method,
              @Nullable Object[] args) throws Throwable {
            // If the method is a method from Object then defer to normal invocation.
            if (method.getDeclaringClass() == Object.class) {
              return method.invoke(this, args);
            }
            if (platform.isDefaultMethod(method)) {
              return platform.invokeDefaultMethod(method, service, proxy, args);
            }
            return loadServiceMethod(method).invoke(args != null ? args : emptyArgs);
          }
        });
  }
@SuppressWarnings("unchecked") // Single-interface proxy creation guarded by parameter safety.
  public <T> T create(final Class<T> service) {
    Utils.validateServiceInterface(service);
    if (validateEagerly) {
      eagerlyValidateMethods(service);
    }
    return (T) Proxy.newProxyInstance(service.getClassLoader(), new Class<?>[] { service },
        new InvocationHandler() {
          private final Platform platform = Platform.get();
          private final Object[] emptyArgs = new Object[0];

          @Override public @Nullable Object invoke(Object proxy, Method method,
              @Nullable Object[] args) throws Throwable {
            // If the method is a method from Object then defer to normal invocation.
            if (method.getDeclaringClass() == Object.class) {
              return method.invoke(this, args);
            }
            if (platform.isDefaultMethod(method)) {
              return platform.invokeDefaultMethod(method, service, proxy, args);
            }
            return loadServiceMethod(method).invoke(args != null ? args : emptyArgs);
          }
        });
  }
Create an implementation of the API endpoints defined by the {@code service} interface.
<p>
The relative path for a given method is obtained from an annotation on the method describing
the request type. The built-in methods are {@link retrofit2.http.GET GET},
{@link retrofit2.http.PUT PUT}, {@link retrofit2.http.POST POST}, {@link retrofit2.http.PATCH
PATCH}, {@link retrofit2.http.HEAD HEAD}, {@link retrofit2.http.DELETE DELETE} and
{@link retrofit2.http.OPTIONS OPTIONS}. You can use a custom HTTP method with
{@link HTTP @HTTP}. For a dynamic URL, omit the path on the annotation and annotate the first
parameter with {@link Url @Url}.
<p>
Method parameters can be used to replace parts of the URL by annotating them with
{@link retrofit2.http.Path @Path}. Replacement sections are denoted by an identifier
surrounded by curly braces (e.g., "{foo}"). To add items to the query string of a URL use
{@link retrofit2.http.Query @Query}.
<p>
The body of a request is denoted by the {@link retrofit2.http.Body @Body} annotation. The
object will be converted to request representation by one of the {@link Converter.Factory}
instances. A {@link RequestBody} can also be used for a raw representation.
<p>
Alternative request body formats are supported by method annotations and corresponding
parameter annotations:
<ul>
<li>{@link retrofit2.http.FormUrlEncoded @FormUrlEncoded} - Form-encoded data with key-value
pairs specified by the {@link retrofit2.http.Field @Field} parameter annotation.
<li>{@link retrofit2.http.Multipart @Multipart} - RFC 2388-compliant multipart data with
parts specified by the {@link retrofit2.http.Part @Part} parameter annotation.
</ul>
<p>
Additional static headers can be added for an endpoint using the
{@link retrofit2.http.Headers @Headers} method annotation. For per-request control over a
header annotate a parameter with {@link Header @Header}.
<p>
By default, methods return a {@link Call} which represents the HTTP request. The generic
parameter of the call is the response body type and will be converted by one of the
{@link Converter.Factory} instances. {@link ResponseBody} can also be used for a raw
representation. {@link Void} can be used if you do not care about the body contents.
<p>
For example:
<pre>
public interface CategoryService {
&#64;POST("category/{cat}/")
Call&lt;List&lt;Item&gt;&gt; categoryList(@Path("cat") String a, @Query("page") int b);
}
</pre>