Package com.authlete.common.util
Class MapUtils
- java.lang.Object
-
- com.authlete.common.util.MapUtils
-
-
Constructor Summary
Constructors Constructor Description MapUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidput(Map<String,Object> target, String key, boolean value, boolean falseIncluded)Put the given key-value pair into thetargetmap when thevalueistrueorfalseIncludedistrue.static voidput(Map<String,Object> target, String key, int value, boolean zeroIncluded)Put the given key-value pair into thetargetmap when thevalueis not 0 orzeroIncludedistrue.static voidput(Map<String,Object> target, String key, long value, boolean zeroIncluded)Put the given key-value pair into thetargetmap when thevalueis not 0 orzeroIncludedistrue.static voidput(Map<String,Object> target, String baseKey, TaggedValue[] array, boolean nullIncluded)Put"{baseKey}#{tag}"properties into thetargetmap.static voidput(Map<String,Object> target, String key, Map<String,Object> value, boolean nullIncluded)Put the given key-value pair into thetargetmap when thevalueis not null ornullIncludedistrue.static <T> voidput(Map<String,Object> target, String key, T[] array, boolean nullIncluded)Put the given key-array pair into thetargetmap when thearrayis notnullornullIncludedistrue.static <T> voidput(Map<String,Object> target, String key, T value, boolean nullIncluded)Put the given key-value pair into thetargetmap when thevalueis notnullornullIncludedistrue.static voidput(Map<String,Object> target, Map<String,Object> map, MapControl control)Put the entries in themapinto thetargetmap.static voidputJsonArray(Map<String,Object> target, String key, String json, boolean nullIncluded)Convert the givenjsoninto aListinstance and put the instance into thetargetmap with thekey.static voidputJsonObject(Map<String,Object> target, String key, String json, boolean nullIncluded)Convert the givenjsoninto aMapinstance and put the instance into thetargetmap with thekey.
-
-
-
Method Detail
-
put
public static void put(Map<String,Object> target, String key, boolean value, boolean falseIncluded)
Put the given key-value pair into thetargetmap when thevalueistrueorfalseIncludedistrue.
-
put
public static void put(Map<String,Object> target, String key, int value, boolean zeroIncluded)
Put the given key-value pair into thetargetmap when thevalueis not 0 orzeroIncludedistrue.
-
put
public static void put(Map<String,Object> target, String key, long value, boolean zeroIncluded)
Put the given key-value pair into thetargetmap when thevalueis not 0 orzeroIncludedistrue.
-
put
public static void put(Map<String,Object> target, String key, Map<String,Object> value, boolean nullIncluded)
Put the given key-value pair into thetargetmap when thevalueis not null ornullIncludedistrue.- Since:
- 3.95
-
put
public static <T> void put(Map<String,Object> target, String key, T value, boolean nullIncluded)
Put the given key-value pair into thetargetmap when thevalueis notnullornullIncludedistrue.Note that the value of
value.toString()is put into thetargetmap, not thevalueitself.
-
put
public static <T> void put(Map<String,Object> target, String key, T[] array, boolean nullIncluded)
Put the given key-array pair into thetargetmap when thearrayis notnullornullIncludedistrue.Note that elements in the array are converted to
Stringinstances by thetoString()method and added to a newListinstance, and theListinstance is put into thetargetmap.
-
put
public static void put(Map<String,Object> target, String baseKey, TaggedValue[] array, boolean nullIncluded)
Put"{baseKey}#{tag}"properties into thetargetmap.
-
putJsonObject
public static void putJsonObject(Map<String,Object> target, String key, String json, boolean nullIncluded)
Convert the givenjsoninto aMapinstance and put the instance into thetargetmap with thekey.If
nullIncludedistrue, thekeyis put into thetargetmap even when the givenjsonisnull.
-
putJsonArray
public static void putJsonArray(Map<String,Object> target, String key, String json, boolean nullIncluded)
Convert the givenjsoninto aListinstance and put the instance into thetargetmap with thekey.If
nullIncludedistrue, thekeyis put into thetargetmap even when the givenjsonisnull.- Since:
- 3.55
-
-