Sha256: e7dbd8514cf676b164155e3c29b7d2bbfd44dbcefc9d319431f21810713ada1a
Contents?: true
Size: 1.64 KB
Versions: 7
Compression:
Stored size: 1.64 KB
Contents
package sh.calaba.instrumentationbackend; import java.io.BufferedWriter; import java.io.CharArrayWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; public class Result { private static Result successResult = new Result(true); boolean success; String message; List<String> bonusInformation = new ArrayList<String>(); public Result() { } public Result(boolean success) { this(success, ""); } public Result(boolean success, String message) { this.success = success; this.message = message; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public boolean isSuccess() { return success; } public void setSuccess(boolean success) { this.success = success; } public void addBonusInformation(String information) { bonusInformation.add(information); } public List<String> getBonusInformation() { return bonusInformation; } public void setExtras(List<String> bonusInformation) { this.bonusInformation = bonusInformation; } public static Result fromThrowable(Throwable t) { Result r = new Result(false, t.getMessage()); CharArrayWriter caw = new CharArrayWriter(); t.printStackTrace(new PrintWriter(caw)); r.addBonusInformation("Exception stack trace:\n" + caw.toString()); return r; } public static Result successResult() { return successResult; } public String toString() { return "Success: " + success + ", message: " + message; } }
Version data entries
7 entries across 7 versions & 1 rubygems