コード例 #1
0
 /**
  * Get complex types that are polymorphic and have recursive references.
  *
  * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
  * @return the {@link Call} object
  */
 public Call<ResponseBody> getValidAsync(final ServiceCallback<Fish> serviceCallback) {
   Call<ResponseBody> call = service.getValid();
   call.enqueue(
       new ServiceResponseCallback<Fish>(serviceCallback) {
         @Override
         public void onResponse(Response<ResponseBody> response, Retrofit retrofit) {
           try {
             serviceCallback.success(getValidDelegate(response, retrofit));
           } catch (ErrorException | IOException exception) {
             serviceCallback.failure(exception);
           }
         }
       });
   return call;
 }
コード例 #2
0
 /**
  * Get complex types that are polymorphic and have recursive references.
  *
  * @throws ErrorException exception thrown from REST call
  * @throws IOException exception thrown from serialization/deserialization
  * @return the Fish object wrapped in {@link ServiceResponse} if successful.
  */
 public ServiceResponse<Fish> getValid() throws ErrorException, IOException {
   Call<ResponseBody> call = service.getValid();
   return getValidDelegate(call.execute(), null);
 }