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

com.dg.libs.rest.handlers.BackgroundThreadResponseHandler Maven / Gradle / Ivy

There is a newer version: 2.9.0
Show newest version
package com.dg.libs.rest.handlers;

import com.dg.libs.rest.callbacks.HttpCallback;
import com.dg.libs.rest.domain.ResponseStatus;

public class BackgroundThreadResponseHandler implements ResponseHandler {

  public static final String TAG = BackgroundThreadResponseHandler.class.getSimpleName();
  protected final HttpCallback callback;

  public BackgroundThreadResponseHandler(HttpCallback callback) {
    this.callback = callback;
  }

  @Override
  public HttpCallback getCallback() {
    return callback;
  }

  @Override
  public void handleSuccess(final T responseData) {
    if (callback != null) {
      callback.onSuccess(responseData);
    }
  }

  @Override
  public void handleError(final ResponseStatus status) {
    if (callback != null) {
      callback.onHttpError(status);
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy