Record Class Result.Ok<Value,Error>
java.lang.Object
java.lang.Record
codes.domix.fun.Result.Ok<Value,Error>
- Type Parameters:
Value- the type of the value contained in the successful resultError- the type of the error contained in the erroneous result, unused here- Record Components:
value- the non-null value that represents the successful result; passingnullthrowsNullPointerException
- All Implemented Interfaces:
Result<Value,Error>
public static record Result.Ok<Value,Error> (Value value)
extends Record
implements Result<Value,Error>
Represents a successful result containing a value of type
Value.
This record implements the Result interface and indicates the "Ok" variant
of a result. It encapsulates a non-null value that represents a successful computation
or action. To model a successful result with no meaningful value use Result<Void, Error>;
for an optional value use Result<Option<Value>, Error>.
-
Nested Class Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.value()Returns the value of thevaluerecord component.
-
Constructor Details
-
Ok
Compact canonical constructor — validates thatvalueis non-null.- Throws:
NullPointerException- ifvalueisnull
-
-
Method Details
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
value
-