All Downloads are FREE. Search and download functionalities are using the official Maven repository.

java-helidon.client.libraries.se.ApiResponseBase.mustache Maven / Gradle / Ivy

There is a newer version: 7.7.0
Show newest version
{{>licenseInfo}}
package {{invokerPackage}};

import java.util.concurrent.ExecutionException;

import io.helidon.common.GenericType;
import io.helidon.common.reactive.Single;
import io.helidon.webclient.WebClientResponse;

{{#appName}}
/**
 * Implementation of a generic-typed response.
 *
 * @param  type of the return value from the generated API method
 */
{{/appName}}
class ApiResponseBase implements ApiResponse {

  private final Single webClientResponse;
  private final GenericType responseType;

  protected ApiResponseBase(GenericType responseType, Single webClientResponse) {
    this.webClientResponse = webClientResponse;
    this.responseType = responseType;
  }

  @Override
  public Single webClientResponse() {
    return webClientResponse;
  }

  @Override
  public Single result() throws ExecutionException, InterruptedException {
    return webClientResponse.get().content().as(responseType);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy