Record Class Result<T>
java.lang.Object
java.lang.Record
jdk.jpackage.internal.util.Result<T>
-
Constructor Summary
ConstructorsConstructorDescriptionResult(Optional<T> value, Collection<? extends Exception> errors) Creates an instance of aResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanallHaveValues(Iterable<? extends Result<?>> results) static booleanallHaveValues(Result<?>... results) final booleanIndicates whether some other object is "equal to" this one.Collection<? extends Exception> errors()Returns the value of theerrorsrecord component.<U> Result<U> booleanfinal inthashCode()Returns a hash code value for this object.booleanhasValue()<U> Result<U> <U> Result<U> static <T> Result<T> of(ThrowingSupplier<T, ? extends E> supplier, Class<? extends E> supplierExceptionType) static <T> Result<T> static <T> Result<T> ofErrors(Collection<? extends Exception> errors) static <T> Result<T> ofValue(T value) peekErrors(Consumer<Collection<? extends Exception>> consumer) final StringtoString()Returns a string representation of this record class.value()Returns the value of thevaluerecord component.
-
Constructor Details
-
Result
Creates an instance of aResultrecord class.- Parameters:
value- the value for thevaluerecord componenterrors- the value for theerrorsrecord component
-
-
Method Details
-
orElseThrow
-
hasValue
public boolean hasValue() -
hasErrors
public boolean hasErrors() -
map
-
flatMap
-
mapErrors
-
peekErrors
-
peekValue
-
firstError
-
of
-
of
public static <T,E extends Exception> Result<T> of(ThrowingSupplier<T, ? extends E> supplier, Class<? extends E> supplierExceptionType) -
ofValue
-
ofErrors
-
ofError
-
allHaveValues
-
allHaveValues
-
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
-
errors
Returns the value of theerrorsrecord component.- Returns:
- the value of the
errorsrecord component
-