Package de.srsoftware.tools
Schnittstelle Result<Content>
- Typparameter:
Content- The expected type of the result payload
public interface Result<Content>
This interface can be used as a result type for functions that may return something or an error.
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibung<Mapped> Result<Mapped> Transform this Result object to another via a mapping function.optional()Create an Optional from a Result.stream()Create a stream of the Payload.static <T> Result<T> Transforms the Result to an Error with appropriate payload type
-
Methodendetails
-
map
Transform this Result object to another via a mapping function.- Typparameter:
Mapped- the payload type of the result of the mapping function- Parameter:
mapper- a function, that processes results and produces results- Gibt zurück:
- the result of the mapping function
-
optional
Create an Optional from a Result.- Gibt zurück:
- An optional containing the Result`s content, if set.
-
stream
Create a stream of the Payload. This may be suitable, if the payload is a collection.- Typparameter:
Inner- the type of the payloads of the elements of the stream- Gibt zurück:
- a stream of results
-
transform
Transforms the Result to an Error with appropriate payload type- Typparameter:
T- the payload type of the returned error- Parameter:
res- if this reslult is an error, it will be transformed using the Error.transform method, otherwise a new Error will be created- Gibt zurück:
- the transformed error
-