Package org.eclipse.hono.util
Class JsonHelper
- java.lang.Object
-
- org.eclipse.hono.util.JsonHelper
-
public final class JsonHelper extends Object
A helper class for working withJsonObject
s.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> T
getValue(io.vertx.core.json.JsonObject jsonObject, String name, Class<T> clazz, T defaultValue)
Gets a value from the given JSON object.
-
-
-
Method Detail
-
getValue
public static <T> T getValue(io.vertx.core.json.JsonObject jsonObject, String name, Class<T> clazz, T defaultValue)
Gets a value from the given JSON object.- Type Parameters:
T
- The type of the value.- Parameters:
jsonObject
- The JSON object to get the value from.name
- The key to return the value for.defaultValue
- A default value to return if the value isnull
or is of an unexpected type.clazz
- The target type.- Returns:
- The value or the given default value if the value is not set or is of an unexpected type.
- Throws:
NullPointerException
- if any of the parameters except defaultValue isnull
.
-
-