コード例 #1
0
 /**
  * Get complex types with array property which is empty.
  *
  * @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 getEmptyAsync(final ServiceCallback<ArrayWrapper> serviceCallback)
     throws IllegalArgumentException {
   if (serviceCallback == null) {
     throw new IllegalArgumentException("ServiceCallback is required for async calls.");
   }
   Call<ResponseBody> call = service.getEmpty();
   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(getEmptyDelegate(response));
           } catch (ErrorException | IOException exception) {
             serviceCallback.failure(exception);
           }
         }
       });
   return serviceCall;
 }
コード例 #2
0
 /**
  * Get complex types with array property which is empty.
  *
  * @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> getEmpty() throws ErrorException, IOException {
   Call<ResponseBody> call = service.getEmpty();
   return getEmptyDelegate(call.execute());
 }