models/either library

Classes

Either<S extends Object?, E extends Exception>
This abstract class defines the success and failure states. in a Either<Success, Failure> manner. Use in cases where it is necessary to handle errors more explicitly. This is done by implemeting the when method as a pattern matching method. Where the success callback is called if the result is a success, and the failure callback is called if the result is a failure.
Failure<S extends Object?, E extends Exception>
the failure branch of the Either class that contains the error of the failure state. The value is of type Exception.
Success<S extends Object?, E extends Exception>
the success class of the Either class that contains the value of the success state.

Typedefs

FailureCallback<S extends Object?, E extends Exception, ReturnType> = ReturnType Function(E error)
SuccessCallback<S extends Object?, E extends Exception, ReturnType> = ReturnType Function(S value)