Package org.eclipse.hono.util
Class JsonHelper
java.lang.Object
org.eclipse.hono.util.JsonHelper
A helper class for working with
JsonObject
s.-
Method Summary
-
Method Details
-
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 arenull
.
-