Package org.qubership.atp.ram.utils
Class JsonHelper
java.lang.Object
org.qubership.atp.ram.utils.JsonHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleangetBooleanValue(com.google.gson.JsonObject request, String key) Check value inJsonObjectby key and return boolean value.static ExecutionStatusesgetExecutionStatus(com.google.gson.JsonObject jsonObject, String key, ExecutionStatuses defaultStatus) Check value inJsonObjectby key and returnExecutionStatuses.getHashSet(com.google.gson.JsonObject jsonObject, String key, HashSet<String> defaultValue) Check value inJsonObjectby key and return HashSet.getListString(com.google.gson.JsonObject jsonObject, String key, List<String> defaultValue) Check value inJsonObjectby key and return string array.static LonggetLongValue(com.google.gson.JsonObject jsonObject, String key) Check value inJsonObjectby key and return long value.static StringgetStringValue(com.google.gson.JsonObject jsonObject, String key) Check value inJsonObjectby key and return string value.static StringgetStringValue(com.google.gson.JsonObject jsonObject, String key, String defaultValue) Check value inJsonObjectby key and return string value.static TestingStatusesgetTestingStatus(com.google.gson.JsonObject jsonObject, String key, TestingStatuses defaultStatus) Check value inJsonObjectby key and returnTestingStatuses.static UUIDgetUuidValue(com.google.gson.JsonObject jsonObject, String key)
-
Method Details
-
getStringValue
public static String getStringValue(com.google.gson.JsonObject jsonObject, String key, String defaultValue) Check value inJsonObjectby key and return string value.- Parameters:
jsonObject-JsonObjectfor find valuekey- for find valuedefaultValue- return when value not exist or empty- Returns:
- value by key or default value
-
getStringValue
Check value inJsonObjectby key and return string value.- Parameters:
jsonObject-JsonObjectfor find valuekey- for find value- Returns:
- value by key or empty
-
getListString
public static List<String> getListString(com.google.gson.JsonObject jsonObject, String key, List<String> defaultValue) Check value inJsonObjectby key and return string array.- Parameters:
jsonObject-JsonObjectfor find valuekey- for find valuedefaultValue- return when value not exist or empty- Returns:
- list of string by key or default list
-
getLongValue
Check value inJsonObjectby key and return long value.- Parameters:
jsonObject-JsonObjectfor find valuekey- for find value- Returns:
- long value by key or System.currentTimeMillis
- Throws:
Exception
-
getExecutionStatus
public static ExecutionStatuses getExecutionStatus(com.google.gson.JsonObject jsonObject, String key, ExecutionStatuses defaultStatus) Check value inJsonObjectby key and returnExecutionStatuses.- Parameters:
jsonObject-JsonObjectfor find valuekey- for find value- Returns:
- status by key or default status
-
getTestingStatus
public static TestingStatuses getTestingStatus(com.google.gson.JsonObject jsonObject, String key, TestingStatuses defaultStatus) Check value inJsonObjectby key and returnTestingStatuses.- Parameters:
jsonObject-JsonObjectfor find valuekey- for find value- Returns:
- status by key or default status
-
getBooleanValue
Check value inJsonObjectby key and return boolean value.- Parameters:
request-JsonObjectfor find valuekey- for find value- Returns:
- value by key or false
-
getHashSet
public static HashSet<String> getHashSet(com.google.gson.JsonObject jsonObject, String key, HashSet<String> defaultValue) Check value inJsonObjectby key and return HashSet.- Parameters:
jsonObject-JsonObjectfor find value.key- for find value.defaultValue- return when value not exist or empty.- Returns:
- value by key or empty
-
getUuidValue
-