Class JsonRpcClient

java.lang.Object
com.xxl.tool.jsonrpc.JsonRpcClient

public class JsonRpcClient extends Object
json-rpc client
Author:
xuxueli
  • Constructor Details

    • JsonRpcClient

      public JsonRpcClient()
  • Method Details

    • newClient

      public static JsonRpcClient newClient()
      build json-rpc client
      Returns:
    • url

      public JsonRpcClient url(String url)
    • timeout

      public JsonRpcClient timeout(int timeout)
    • header

      public JsonRpcClient header(Map<String,String> headers)
    • header

      public JsonRpcClient header(String key, String value)
    • proxy

      public <T> T proxy(Class<T> serviceInterface)
    • proxy

      public <T> T proxy(String service, Class<T> serviceInterface)
      proxy service
      Type Parameters:
      T - the service interface
      Parameters:
      service - the service name
      serviceInterface - the service interface
      Returns:
      service
    • invoke

      public <T> T invoke(String service, String method, Object[] params, Class<T> responseType)
      invoke with params
      Type Parameters:
      T - the response type
      Parameters:
      service - the service name
      method - the method name
      params - the method params
      responseType - the response type
      Returns:
      response the response
    • invoke

      public <T> T invoke(String service, String method, Object[] params, Class<T> responseType, Type[] typeArguments)
      invoke with params
      Type Parameters:
      T - the response type
      Parameters:
      service - the service name
      method - the method name
      params - the method params
      responseType - the response type
      typeArguments - the response type arguments
      Returns:
      response the response