// Path: android-rest-lib/src/main/java/com/dg/libs/rest/callbacks/HttpCallback.java
// public interface HttpCallback<T> {
// 
//   /**
//    * This method shows that the callback successfully finished. It contains
//    * response data which represents the return type of the callback.
//    * 
//    * @param responseData
//    *          It can be of any type.
//    */
//   void onSuccess(T responseData, ResponseStatus responseStatus);
// 
//   /**
//    * This method shows that the callback has failed due to server issue, no
//    * connectivity or parser error
//    * 
//    * @param responseStatus
//    */
//   void onHttpError(ResponseStatus responseStatus);
// 
// }
// 
// Path: android-rest-lib/src/main/java/com/dg/libs/rest/domain/ResponseStatus.java
// public class ResponseStatus {
// 
//   public static final String TAG = ResponseStatus.class.getSimpleName();
// 
//   private int statusCode;
//   private String statusMessage;
// 
//   public ResponseStatus(int statusCode, String statusMessage) {
//     this.statusCode = statusCode;
//     this.statusMessage = statusMessage;
//   }
// 
//   public ResponseStatus() {
//   }
// 
//   public int getStatusCode() {
//     return statusCode;
//   }
// 
//   public void setStatusCode(int statusCode) {
//     this.statusCode = statusCode;
//   }
// 
//   public String getStatusMessage() {
//     return statusMessage;
//   }
// 
//   public void setStatusMessage(String statusMessage) {
//     this.statusMessage = statusMessage;
//   }
// 
//   public static ResponseStatus getConnectionErrorStatus() {
//     ResponseStatus status = new ResponseStatus();
//     status.setStatusCode(HttpStatus.SC_REQUEST_TIMEOUT);
//     status.setStatusMessage("HTTP Connection Error");
//     return status;
//   }
// 
//   public static ResponseStatus getParseErrorStatus() {
//     ResponseStatus status = new ResponseStatus();
//     status.setStatusCode(HttpStatus.SC_BAD_REQUEST);
//     status.setStatusMessage("Parser Error");
//     return status;
//   }
// 
//   @Override
//   public String toString() {
//     StringBuilder builder = new StringBuilder();
//     builder.append("ResponseStatus [statusCode=");
//     builder.append(statusCode);
//     builder.append(", statusMessage=");
//     builder.append(statusMessage);
//     builder.append("]");
//     return builder.toString();
//   }
// 
// }


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


public class BackgroundThreadResponseHandler<T> implements ResponseHandler<T> {

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

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

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

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

  @Override
// Path: android-rest-lib/src/main/java/com/dg/libs/rest/callbacks/HttpCallback.java
// public interface HttpCallback<T> {
// 
//   /**
//    * This method shows that the callback successfully finished. It contains
//    * response data which represents the return type of the callback.
//    * 
//    * @param responseData
//    *          It can be of any type.
//    */
//   void onSuccess(T responseData, ResponseStatus responseStatus);
// 
//   /**
//    * This method shows that the callback has failed due to server issue, no
//    * connectivity or parser error
//    * 
//    * @param responseStatus
//    */
//   void onHttpError(ResponseStatus responseStatus);
// 
// }
// 
// Path: android-rest-lib/src/main/java/com/dg/libs/rest/domain/ResponseStatus.java
// public class ResponseStatus {
// 
//   public static final String TAG = ResponseStatus.class.getSimpleName();
// 
//   private int statusCode;
//   private String statusMessage;
// 
//   public ResponseStatus(int statusCode, String statusMessage) {
//     this.statusCode = statusCode;
//     this.statusMessage = statusMessage;
//   }
// 
//   public ResponseStatus() {
//   }
// 
//   public int getStatusCode() {
//     return statusCode;
//   }
// 
//   public void setStatusCode(int statusCode) {
//     this.statusCode = statusCode;
//   }
// 
//   public String getStatusMessage() {
//     return statusMessage;
//   }
// 
//   public void setStatusMessage(String statusMessage) {
//     this.statusMessage = statusMessage;
//   }
// 
//   public static ResponseStatus getConnectionErrorStatus() {
//     ResponseStatus status = new ResponseStatus();
//     status.setStatusCode(HttpStatus.SC_REQUEST_TIMEOUT);
//     status.setStatusMessage("HTTP Connection Error");
//     return status;
//   }
// 
//   public static ResponseStatus getParseErrorStatus() {
//     ResponseStatus status = new ResponseStatus();
//     status.setStatusCode(HttpStatus.SC_BAD_REQUEST);
//     status.setStatusMessage("Parser Error");
//     return status;
//   }
// 
//   @Override
//   public String toString() {
//     StringBuilder builder = new StringBuilder();
//     builder.append("ResponseStatus [statusCode=");
//     builder.append(statusCode);
//     builder.append(", statusMessage=");
//     builder.append(statusMessage);
//     builder.append("]");
//     return builder.toString();
//   }
// 
// }


// Path: android-rest-lib/src/main/java/com/dg/libs/rest/handlers/BackgroundThreadResponseHandler.java
import com.dg.libs.rest.callbacks.HttpCallback;
import com.dg.libs.rest.domain.ResponseStatus;

package com.dg.libs.rest.handlers;


public class BackgroundThreadResponseHandler<T> implements ResponseHandler<T> {

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

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

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

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

  @Override
  public void handleError(final ResponseStatus status) {