public final class ParseResult<T> extends Object
Parser.parse(int, int)
call. This is either successful (success(T)
) or an error
(error()
).Modifier and Type | Method and Description |
---|---|
static <T> ParseResult<T> |
error()
Create an error result.
|
boolean |
hasResult()
Returns true if the parse result was successful.
|
<U> ParseResult<U> |
mapResult(Function<T,U> mapper)
Convert the value in this parse result (if successful) using the provided function.
|
T |
result()
Returns the result of parsing.
|
static <T> ParseResult<T> |
success(T result)
Create a successful result with the provided value.
|
public static <T> ParseResult<T> success(T result)
public static <T> ParseResult<T> error()
public <U> ParseResult<U> mapResult(Function<T,U> mapper)
public boolean hasResult()
public T result()
Copyright © 2021. All rights reserved.