@Override public void writeToParcel(Parcel parcel, int flags) { // Data written to parcel is: // 1. int errorReason // 2. boolean [] { isTransient } // 3. String error message // TODO: Add support for object marshaling when needed parcel.writeInt(errorInfo.getErrorReason()); parcel.writeBooleanArray(new boolean[] {errorInfo.isTransient()}); parcel.writeString(errorInfo.getErrorMessage()); }
@Override public int hashCode() { return errorInfo.hashCode(); }
@Override public boolean equals(Object object) { return object instanceof ParcelableErrorInfo && errorInfo.equals(((ParcelableErrorInfo) object).errorInfo); }
/** Creates a new ErrorInfo wrapper by reading data from a parcel. */ public ParcelableErrorInfo(Parcel in) { int reason = in.readInt(); boolean isTransient = in.createBooleanArray()[0]; String message = in.readString(); this.errorInfo = ErrorInfo.newInstance(reason, isTransient, message, null); }