Modifier and Type | Method and Description |
---|---|
static Function<JsonValue,Charset,JsonValueException> |
charset()
Returns the JSON string value as a character set used for byte
encoding/decoding.
|
static Function<JsonValue,JsonValue,JsonValueException> |
deepTransformBy(Function<JsonValue,?,JsonValueException> function)
Returns the JSON value as the result of a deep JsonValue object-traversal,
applying the provided transform
function to each element. |
static Function<JsonValue,Duration,JsonValueException> |
duration()
Returns the JSON string value as a
Duration . |
static <T extends Enum<T>> |
enumConstant(Class<T> type)
Returns the JSON string value as an enum constant of the specified enum
type.
|
static Function<JsonValue,File,JsonValueException> |
file()
Returns the JSON string value as a
File object. |
static Function<JsonValue,JsonValue,JsonValueException> |
identity()
Returns an identity function that will copy the input
JsonValue . |
static Function<JsonValue,Instant,JsonValueException> |
instant()
|
static Function<JsonValue,Integer,NumberFormatException> |
integer()
Returns an
Integer by converting the JsonValue using JsonValue.asInteger() , or by parsing the
JsonValue string using Integer.parseInt(String) . |
static <V,E extends Exception> |
listOf(Function<JsonValue,V,E> transformFunction)
Returns the JSON value as a
List containing objects whose type
(and value) is specified by a transformation function. |
static Function<JsonValue,Boolean,NeverThrowsException> |
parseBoolean()
Returns a
Boolean by converting the JsonValue using JsonValue.asLong() , or by parsing the
JsonValue string using Boolean.parseBoolean(String) . |
static Function<JsonValue,Long,NumberFormatException> |
parseLong()
Returns a
Long by converting the JsonValue using JsonValue.asLong() , or by parsing the JsonValue
string using Long.parseLong(String) . |
static Function<JsonValue,Pattern,JsonValueException> |
pattern()
Returns the JSON string value as a regular expression pattern.
|
static Function<JsonValue,JsonPointer,JsonValueException> |
pointer()
Returns the JSON string value as a JSON pointer.
|
static <V> Function<JsonValue,Set<V>,JsonValueException> |
setOf(Class<V> type)
Returns the JSON value as a
Set containing objects whose type
(and value) is specified by the parameter type . |
static <V,E extends Exception> |
setOf(Function<JsonValue,V,E> transformFunction)
Returns the JSON value as a
Set containing objects whose type
(and value) is specified by a transformation function. |
static Function<JsonValue,URI,JsonValueException> |
uri()
Returns the JSON string value as a uniform resource identifier.
|
static Function<JsonValue,URL,JsonValueException> |
url()
Returns the JSON string value as a uniform resource locator.
|
static Function<JsonValue,UUID,JsonValueException> |
uuid()
Returns the JSON string value as a universally unique identifier (UUID).
|
public static Function<JsonValue,Charset,JsonValueException> charset()
null
, this function returns
null
.JsonValueException
- if the JSON value is not a string or the character set
specified is invalid.public static Function<JsonValue,Duration,JsonValueException> duration()
JsonValueException
- if the JSON value is not a string or the duration
specified is invalid.public static <T extends Enum<T>> Function<JsonValue,T,JsonValueException> enumConstant(Class<T> type)
null
, this method returns
null
.T
- the enum type sub-class.type
- the enum type to match constants with the value.IllegalArgumentException
- if type
does not represent an enum type. or
if the JSON value does not match any of the enum's constants.NullPointerException
- if type
is null
.public static Function<JsonValue,File,JsonValueException> file()
File
object. If the JSON value
is null
, this method returns null
.JsonValueException
- if the JSON value is not a string.public static Function<JsonValue,Instant,JsonValueException> instant()
Function
to transform a JsonValue
representing a UTC format datetime to an
Instant
. The function returns null if the JSON represents a null value and will raise if JSON
date is not in UTC format.Instant
representation of a JSON UTC datepublic static Function<JsonValue,Pattern,JsonValueException> pattern()
null
, this method returns null
.JsonValueException
- if the pattern is not a string or the value is not a valid
regular expression pattern.public static Function<JsonValue,JsonPointer,JsonValueException> pointer()
null
, this method returns null
.JsonValueException
- if the JSON value is not a string or valid JSON pointer.public static Function<JsonValue,URI,JsonValueException> uri()
null
, this method returns null
.JsonValueException
- if the given string violates URI syntax.public static Function<JsonValue,URL,JsonValueException> url()
null
, this method returns null
.JsonValueException
- if the given string violates URL syntax.public static Function<JsonValue,UUID,JsonValueException> uuid()
null
, this method returns null
.JsonValueException
- if the JSON value is not a string or valid UUID.public static <V,E extends Exception> Function<JsonValue,List<V>,E> listOf(Function<JsonValue,V,E> transformFunction)
List
containing objects whose type
(and value) is specified by a transformation function. If the value is
null
, this method returns null
. It is up to the
transformation function to transform/enforce source types of the elements
in the Json source collection. If any of the elements of the list are not of
the appropriate type, or the type-transformation cannot occur,
the exception specified by the transformation function is thrown.V
- the type of elements in this listE
- the type of exception thrown by the transformation functiontransformFunction
- a Function
to transform an element of the JsonValue list
to the desired typenull
if no value.NullPointerException
- if transformFunction
is null
.public static <V,E extends Exception> Function<JsonValue,Set<V>,E> setOf(Function<JsonValue,V,E> transformFunction)
Set
containing objects whose type
(and value) is specified by a transformation function. If the value is
null
, this method returns null
. It is up to the
transformation function to transform/enforce source types of the elements
in the Json source collection. If called on an object which wraps a List,
this method will drop duplicates performing element comparisons using
equals/hashCode. If any of the elements of the collection are not of
the appropriate type, or the type-transformation cannot occur, the
exception specified by the transformation function is thrown.V
- the type of elements in this setE
- the type of exception thrown by the transformation functiontransformFunction
- a Function
to transform an element of the JsonValue set
to the desired typenull
if no value.NullPointerException
- if transformFunction
is null
.public static <V> Function<JsonValue,Set<V>,JsonValueException> setOf(Class<V> type)
Set
containing objects whose type
(and value) is specified by the parameter type
. If the value is
null
, this method returns null
. If called on an object
which wraps a List, this method will drop duplicates performing element
comparisons using equals/hashCode. If any of the elements of the collection
are not of the appropriate type, or the type-transformation cannot occur,
JsonValueException
is thrown.V
- the type of elements in this settype
- a Class
that specifies the desired type of each element
in the resultant JsonValue setnull
if no value.NullPointerException
- if type
is null
.JsonValueException
- if the elements of the collection cannot be cast as type
.public static Function<JsonValue,JsonValue,JsonValueException> deepTransformBy(Function<JsonValue,?,JsonValueException> function)
function
to each element.function
- a Function
that applies the desired element transformation
in the resultant JsonValue setJsonValueException
- if the elements of the JsonValue cannot be transformed by function
.public static Function<JsonValue,JsonValue,JsonValueException> identity()
JsonValue
.JsonValue
.JsonValueException
- if an error occurred while copying the input.public static Function<JsonValue,Integer,NumberFormatException> integer()
Integer
by converting the JsonValue using JsonValue.asInteger()
, or by parsing the
JsonValue string using Integer.parseInt(String)
.NumberFormatException
- if unable to parse the JsonValue as an Integer
public static Function<JsonValue,Long,NumberFormatException> parseLong()
Long
by converting the JsonValue using JsonValue.asLong()
, or by parsing the JsonValue
string using Long.parseLong(String)
.Long
NumberFormatException
- if unable to parse the JsonValue as an Long
public static Function<JsonValue,Boolean,NeverThrowsException> parseBoolean()
Boolean
by converting the JsonValue using JsonValue.asLong()
, or by parsing the
JsonValue string using Boolean.parseBoolean(String)
.Boolean
Copyright © 2010-2018, ForgeRock All Rights Reserved.