public final class TryObj extends Object
Modifier and Type | Method | Description |
---|---|---|
boolean |
isFailure() |
Returns true if the parsed string is a malformed json object.
|
boolean |
isSuccess() |
Returns true if the parsed string is a well-formed json object.
|
JsObj |
orElse(Supplier<JsObj> other) |
Returns the computed JsObj if the parsed string is a well-formed json object, returning the JsObj
given by the supplier otherwise.
|
JsObj |
orElseThrow() |
Returns the computed JsObj if the parsed string is a well-formed json object, throwing an exception
otherwise.
|
Optional<JsObj> |
toOptional() |
Returns the computed json object wrapped in an optional if the parsed string is a well-formed
json object, returning an empty optional otherwise.
|
public boolean isFailure()
public boolean isSuccess()
public Optional<JsObj> toOptional()
public JsObj orElseThrow() throws MalformedJson
MalformedJson
- if this try is a failureCopyright © 2019. All rights reserved.