APIdia Launch Partner
Top Fields Constructors Methods
jdk.jpackage.internal.util

public final Record Result<T>

extends Record
Class Inheritance
Record Components
value:Optional<T> 
errors:Collection<? extends Exception> 
Imports
java.util.Collection, .List, .Objects, .Optional, java.util.function.Consumer, .Function, .Supplier, java.util.stream.StreamSupport, jdk.jpackage.internal.util.function.ExceptionBox, .ThrowingSupplier

Field Summary

Modifier and TypeField and Description
private final Collection<? extends Exception>
errors

Record Component accessed by errors().

private final Optional<T>
value

Record Component accessed by value().

Constructor Summary

AccessConstructor and Description
public
Result(Optional<T> value, Collection<? extends Exception> errors)

Method Summary

Modifier and TypeMethod and Description
public static boolean
allHaveValues(Iterable<? extends Result<?>> results)

public static boolean
allHaveValues(Result<?>... results)

public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public Collection<? extends Exception>
errors()

Record Component getter of errors.

public Optional<? extends Exception>
public <U> Result<U>
flatMap(Function<T, Result<U>> conv)

public boolean
public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public boolean
public <U> Result<U>
map(Function<T, U> conv)

public <U> Result<U>
public static <T> Result<T>
of(Supplier<T> supplier)

public static <T, E extends Exception> Result<T>
of(ThrowingSupplier<T, ? extends E> supplier, Class<? extends E> supplierExceptionType)

public static <T> Result<T>
public static <T> Result<T>
ofErrors(Collection<? extends Exception> errors)

public static <T> Result<T>
ofValue(T value)

public T
public Result<T>
peekErrors(Consumer<Collection<? extends Exception>> consumer)

public Result<T>
peekValue(Consumer<T> consumer)

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

public Optional<T>
value()

Record Component getter of value.

Field Detail

errorsback to summary
private final Collection<? extends Exception> errors

Record Component accessed by errors().

valueback to summary
private final Optional<T> value

Record Component accessed by value().

Constructor Detail

Resultback to summary
public Result(Optional<T> value, Collection<? extends Exception> errors)

Method Detail

allHaveValuesback to summary
public static boolean allHaveValues(Iterable<? extends Result<?>> results)
allHaveValuesback to summary
public static boolean allHaveValues(Result<?>... results)
equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
errorsback to summary
public Collection<? extends Exception> errors()

Record Component getter of errors.

firstErrorback to summary
public Optional<? extends Exception> firstError()
flatMapback to summary
public <U> Result<U> flatMap(Function<T, Result<U>> conv)
hasErrorsback to summary
public boolean hasErrors()
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

hasValueback to summary
public boolean hasValue()
mapback to summary
public <U> Result<U> map(Function<T, U> conv)
mapErrorsback to summary
public <U> Result<U> mapErrors()
Annotations
@SuppressWarnings:unchecked
ofback to summary
public static <T> Result<T> of(Supplier<T> supplier)
ofback to summary
public static <T, E extends Exception> Result<T> of(ThrowingSupplier<T, ? extends E> supplier, Class<? extends E> supplierExceptionType)
ofErrorback to summary
public static <T> Result<T> ofError(Exception error)
ofErrorsback to summary
public static <T> Result<T> ofErrors(Collection<? extends Exception> errors)
ofValueback to summary
public static <T> Result<T> ofValue(T value)
orElseThrowback to summary
public T orElseThrow()
peekErrorsback to summary
public Result<T> peekErrors(Consumer<Collection<? extends Exception>> consumer)
peekValueback to summary
public Result<T> peekValue(Consumer<T> consumer)
toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

valueback to summary
public Optional<T> value()

Record Component getter of value.