Class JsonUtils
java.lang.Object
de.christofreichardt.json.JsonUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends jakarta.json.JsonValue>
TorElseThrow(jakarta.json.JsonObject jsonObject, String key, Class<T> jsonType) Used to access a typed name/value pair of the givenJsonObject.
-
Method Details
-
orElseThrow
public static <T extends jakarta.json.JsonValue> T orElseThrow(jakarta.json.JsonObject jsonObject, String key, Class<T> jsonType) Used to access a typed name/value pair of the givenJsonObject. Either if the name/value pair doesn't exist or if the requested type of the value cannot be satisfied anIllegalArgumentExceptionwill be thrown. At present only JsonString values can be requested.- Type Parameters:
T- the type of theJsonValue- Parameters:
jsonObject- the object to be worked withkey- the key whose associated value we are interested injsonType- the desired class of theJsonValue- Returns:
- the associated value
-