Ejemplo n.º 1
0
 /**
  * Get complex types with array property.
  *
  * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
  * @throws IllegalArgumentException thrown if callback is null
  * @return the {@link Call} object
  */
 public ServiceCall getValidAsync(final ServiceCallback<ArrayWrapper> serviceCallback)
     throws IllegalArgumentException {
   if (serviceCallback == null) {
     throw new IllegalArgumentException("ServiceCallback is required for async calls.");
   }
   Call<ResponseBody> call = service.getValid();
   final ServiceCall serviceCall = new ServiceCall(call);
   call.enqueue(
       new ServiceResponseCallback<ArrayWrapper>(serviceCallback) {
         @Override
         public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
           try {
             serviceCallback.success(getValidDelegate(response));
           } catch (ErrorException | IOException exception) {
             serviceCallback.failure(exception);
           }
         }
       });
   return serviceCall;
 }
Ejemplo n.º 2
0
 /**
  * Get complex types with array property.
  *
  * @throws ErrorException exception thrown from REST call
  * @throws IOException exception thrown from serialization/deserialization
  * @return the ArrayWrapper object wrapped in {@link ServiceResponse} if successful.
  */
 public ServiceResponse<ArrayWrapper> getValid() throws ErrorException, IOException {
   Call<ResponseBody> call = service.getValid();
   return getValidDelegate(call.execute());
 }