Class RestClientInvocationHandler

java.lang.Object
com.shri.restinpeace.proxy.RestClientInvocationHandler
All Implemented Interfaces:
InvocationHandler

public class RestClientInvocationHandler extends Object implements InvocationHandler
JDK dynamic proxy handler backing every client returned by RIP.getClient(Class). Routes Object methods (toString/equals/hashCode) to proxy-aware implementations, a default interface method (e.g. a convenience wrapper calling another method on the same @RestClient interface) to its own real implementation, and every other method call to RequestExecutor based on its HTTP method annotation.
  • Constructor Details

    • RestClientInvocationHandler

      public RestClientInvocationHandler()
      Creates a handler backed by a fresh RequestExecutor with no runtime base URL override.
    • RestClientInvocationHandler

      public RestClientInvocationHandler(String baseUrlOverride)
      Creates a handler backed by a fresh RequestExecutor that resolves every relative method URL against baseUrlOverride.
      Parameters:
      baseUrlOverride - the runtime base URL, or null to fall back to the interface's @BaseUrl
    • RestClientInvocationHandler

      public RestClientInvocationHandler(RipClientConfig config)
      Creates a handler backed by a fresh RequestExecutor built from config.
      Parameters:
      config - the per-client settings
    • RestClientInvocationHandler

      public RestClientInvocationHandler(RequestExecutor requestExecutor)
      Creates a handler backed by an already-built RequestExecutor, instead of constructing a fresh one from a base URL or config - used by a compile-time-generated <Interface>_RipImpl class to build its own internal reflective fallback proxy (for the one method, if any, outside RestClientProcessor's codegen-supported shape) that shares this exact client's retry/cache/interceptor/timeout config, rather than one built from scratch with none of it. Not part of the public API surface a consumer is expected to call directly.
      Parameters:
      requestExecutor - the already-built request executor to reuse
  • Method Details