This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The result of some method call provides the caller with a requested [value] if the call is successful or an [exception] if failed. | |
* Replaces the usual approach to throw an exception or return the null in case of an execution failure. | |
* Note: [Result.exception] of the successful [Result] is always `null`. | |
*/ | |
@Suppress("UNCHECKED_CAST") | |
class Result<T> { | |
private var result: Any? = null | |
private var success = true |