Back to project page foreman.
The source code is released under:
GNU General Public License
If you think the Android project foreman listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.ajaso.android.foreman; //from w ww . j av a 2s. c om /** * Author: Adam J Jaso, Jr * Copyright: Adam J Jaso, Jr 2014 */ public class BasicResult implements Result { private boolean error; private int errorCode; private String msg; private Object data; @Override public boolean hasError() { return error; } @Override public int errorCode() { return errorCode; } @Override public String message() { return msg; } @Override public Object data() { return data; } public BasicResult success(Object data) { this.error = false; this.errorCode = 0; this.msg = ""; this.data = data; return this; } public BasicResult failure(int code, String msg, Object data) { this.error = true; this.errorCode = code; this.msg = msg; this.data = data; return this; } public BasicResult failure(String msg, Object data) { return failure(-1, msg, data); } public BasicResult failure(String msg) { return failure(-1, msg, null); } public String toString() { return "BasicResult: ["+error+", "+errorCode+", "+msg+", "+data+"]"; } }