public class ParseResult<T> extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ParseResult.CONFIDENCE |
static class |
ParseResult.STATUS |
Constructor and Description |
---|
ParseResult(ParseResult.STATUS status,
ParseResult.CONFIDENCE confidence,
T payload,
List<T> alternativePayloads,
Throwable error)
Forces all fields to be provided
|
Modifier and Type | Method and Description |
---|---|
static <T1> ParseResult<T1> |
error() |
static <T1> ParseResult<T1> |
error(Throwable cause) |
static <T1> ParseResult<T1> |
fail() |
List<T> |
getAlternativePayloads() |
ParseResult.CONFIDENCE |
getConfidence() |
Throwable |
getError() |
T |
getPayload() |
ParseResult.STATUS |
getStatus() |
boolean |
isSuccessful()
Returns true if
getStatus() returns SUCCESS. |
static <T1> ParseResult<T1> |
success(ParseResult.CONFIDENCE confidence,
T1 payload) |
String |
toString() |
public ParseResult(ParseResult.STATUS status, ParseResult.CONFIDENCE confidence, T payload, List<T> alternativePayloads, Throwable error)
status
- The status of the responseconfidence
- The confidence in the resultpayload
- The payload of the responseerror
- The error in the responsepublic static <T1> ParseResult<T1> success(ParseResult.CONFIDENCE confidence, T1 payload)
T1
- The generic type of the payloadconfidence
- The confidence in the resultpayload
- The payload of the parse resultpublic static <T1> ParseResult<T1> fail()
public static <T1> ParseResult<T1> error()
public static <T1> ParseResult<T1> error(Throwable cause)
cause
- The cause of the errorpublic ParseResult.STATUS getStatus()
public ParseResult.CONFIDENCE getConfidence()
public T getPayload()
public List<T> getAlternativePayloads()
public boolean isSuccessful()
getStatus()
returns SUCCESS.Copyright © 2024 Global Biodiversity Information Facility (GBIF). All rights reserved.