Class POBExtensions
-
- All Implemented Interfaces:
public final class POBExtensions
-
-
Method Summary
Modifier and Type Method Description final static JSONArraytoTrimmedNonEmptyStringsArray(JSONArray $self)Returns a new JSONArray containing trimmed, non-empty strings from this array (using JSONArray.optString for each index). final static JSONArraytoValueJsonArray(JSONObject $self)Flattens this object (string keys, each value a JSONArray of strings) into a single JSONArray of all trimmed non-empty strings from every inner array, in key iteration order. final static JSONObjectputIfNotNullOrEmpty(JSONObject $self, String key, String value)Extension function to add key-value only if the value is not null or empty final static JSONObjectputIfNotEmpty(JSONObject $self, String key, JSONObject value)Extension function to add a key-value pair to a JSONObject only if the value JSONObject is not empty. -
-
Method Detail
-
toTrimmedNonEmptyStringsArray
final static JSONArray toTrimmedNonEmptyStringsArray(JSONArray $self)
Returns a new JSONArray containing trimmed, non-empty strings from this array (using JSONArray.optString for each index).
-
toValueJsonArray
final static JSONArray toValueJsonArray(JSONObject $self)
Flattens this object (string keys, each value a JSONArray of strings) into a single JSONArray of all trimmed non-empty strings from every inner array, in key iteration order. Duplicate strings (within one inner array or across keys) are omitted; the first occurrence wins.
Returns null if this object is empty or no inner array contains valid entries. Returns unique values Used for imp.ext.owsdk.appstatusschemes as one flat string array (not array-of-arrays). input {"appInstallStatus":{"android":{"temu.com":"temu"},"iOS":{"temu.com":"temu"}}} output "temu"
-
putIfNotNullOrEmpty
final static JSONObject putIfNotNullOrEmpty(JSONObject $self, String key, String value)
Extension function to add key-value only if the value is not null or empty
- Parameters:
key- The key under which thejsonValuewill be added.value- Value to be added to the currentJSONObject.
-
putIfNotEmpty
final static JSONObject putIfNotEmpty(JSONObject $self, String key, JSONObject value)
Extension function to add a key-value pair to a JSONObject only if the value JSONObject is not empty.
- Parameters:
key- The key under which thevaluewill be added.value- The JSONObject to be added.
-
-
-
-