java.lang.Object
org.shredzone.acme4j.toolbox.JSON.Value
- Enclosing class:
- JSON
A single JSON value. This instance also covers
null
values.
All return values are never null
unless specified otherwise. For optional
parameters, use optional()
.
-
Method Summary
Modifier and TypeMethodDescriptionasArray()
Returns the value asJSON.Array
.byte[]
asBinary()
Returns the value as base64 decoded byte array.boolean
Returns the value as boolean.Returns the value asDuration
.Returns the value as JSON object that was Base64 URL encoded.Returns the value asIdentifier
.Returns the value asInstant
.int
asInt()
Returns the value as int.asObject()
Returns the value as JSON object.Returns the value asProblem
.asStatus()
Returns the parsedStatus
.asString()
Returns the value asString
.asURI()
Returns the value asURI
.asURL()
Returns the value asURL
.boolean
int
hashCode()
boolean
Checks if this value isnull
.<T> Optional<T>
map
(Function<JSON.Value, T> mapper) Returns this value as anOptional
of the desired type, for further mapping and filtering.Returns this value.optional()
Returns this value asOptional
, for further mapping and filtering.
-
Method Details
-
isPresent
Checks if this value isnull
.- Returns:
true
if this value is present,false
ifnull
.
-
optional
Returns this value asOptional
, for further mapping and filtering.- Returns:
Optional
of this value, orOptional.empty()
if this value isnull
.- See Also:
-
onFeature
Returns this value. If the value wasnull
, anAcmeNotSupportedException
is thrown. This method is used for mandatory fields that are only present if a certain feature is supported by the server.- Parameters:
feature
- Feature name- Returns:
- itself
-
map
Returns this value as anOptional
of the desired type, for further mapping and filtering.- Parameters:
mapper
- AFunction
that converts aJSON.Value
to the desired type- Returns:
Optional
of this value, orOptional.empty()
if this value isnull
.- See Also:
-
asString
Returns the value asString
. -
asObject
Returns the value as JSON object. -
asEncodedObject
Returns the value as JSON object that was Base64 URL encoded.- Since:
- 2.8
-
asProblem
Returns the value asProblem
.- Parameters:
baseUrl
- BaseURL
to resolve relative links against
-
asIdentifier
Returns the value asIdentifier
.- Since:
- 2.3
-
asArray
Returns the value asJSON.Array
.Unlike the other getters, this method returns an empty array if the value is not set. Use
isPresent()
to find out if the value was actually set. -
asInt
Returns the value as int. -
asBoolean
Returns the value as boolean. -
asURI
Returns the value asURI
. -
asURL
Returns the value asURL
. -
asInstant
Returns the value asInstant
. -
asDuration
Returns the value asDuration
.- Since:
- 2.3
-
asBinary
Returns the value as base64 decoded byte array. -
asStatus
Returns the parsedStatus
. -
equals
-
hashCode
-