Class RestClientOperationWrapper<T>

java.lang.Object
es.kukenan.smartfi.common.utils.RestClientOperationWrapper<T>
Type Parameters:
T - the result type of the wrapped operation.

public class RestClientOperationWrapper<T> extends Object
Utils for REST Client operations.
  • Field Details

    • supplier

      private final Supplier<T> supplier
      The operation to wrap.
  • Constructor Details

    • RestClientOperationWrapper

      public RestClientOperationWrapper(Supplier<T> supplier)
      State constructor.
      Parameters:
      supplier - The operation to wrap.
  • Method Details

    • execute

      public T execute()
      Wrap a rest operation to uniform exception handling.
      Returns:
      the return value of the rest operation invocation.
    • message

      private String message(org.springframework.web.client.ResourceAccessException e)
      Construct an error message for a resource access exception.
      Parameters:
      e - the exception to use to get the error message from.
      Returns:
      an error message.