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 void
put(Map<String,Object> target, String key, boolean value, boolean falseIncluded)
Put the given key-value pair into thetarget
map when thevalue
istrue
orfalseIncluded
istrue
.static void
put(Map<String,Object> target, String key, int value, boolean zeroIncluded)
Put the given key-value pair into thetarget
map when thevalue
is not 0 orzeroIncluded
istrue
.static void
put(Map<String,Object> target, String key, long value, boolean zeroIncluded)
Put the given key-value pair into thetarget
map when thevalue
is not 0 orzeroIncluded
istrue
.static void
put(Map<String,Object> target, String baseKey, TaggedValue[] array, boolean nullIncluded)
Put"{baseKey}#{tag}"
properties into thetarget
map.static void
put(Map<String,Object> target, String key, Map<String,Object> value, boolean nullIncluded)
Put the given key-value pair into thetarget
map when thevalue
is not null ornullIncluded
istrue
.static <T> void
put(Map<String,Object> target, String key, T[] array, boolean nullIncluded)
Put the given key-array pair into thetarget
map when thearray
is notnull
ornullIncluded
istrue
.static <T> void
put(Map<String,Object> target, String key, T value, boolean nullIncluded)
Put the given key-value pair into thetarget
map when thevalue
is notnull
ornullIncluded
istrue
.static void
put(Map<String,Object> target, Map<String,Object> map, MapControl control)
Put the entries in themap
into thetarget
map.static void
putJsonArray(Map<String,Object> target, String key, String json, boolean nullIncluded)
Convert the givenjson
into aList
instance and put the instance into thetarget
map with thekey
.static void
putJsonObject(Map<String,Object> target, String key, String json, boolean nullIncluded)
Convert the givenjson
into aMap
instance and put the instance into thetarget
map 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 thetarget
map when thevalue
istrue
orfalseIncluded
istrue
.
-
put
public static void put(Map<String,Object> target, String key, int value, boolean zeroIncluded)
Put the given key-value pair into thetarget
map when thevalue
is not 0 orzeroIncluded
istrue
.
-
put
public static void put(Map<String,Object> target, String key, long value, boolean zeroIncluded)
Put the given key-value pair into thetarget
map when thevalue
is not 0 orzeroIncluded
istrue
.
-
put
public static void put(Map<String,Object> target, String key, Map<String,Object> value, boolean nullIncluded)
Put the given key-value pair into thetarget
map when thevalue
is not null ornullIncluded
istrue
.- 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 thetarget
map when thevalue
is notnull
ornullIncluded
istrue
.Note that the value of
value.toString()
is put into thetarget
map, not thevalue
itself.
-
put
public static <T> void put(Map<String,Object> target, String key, T[] array, boolean nullIncluded)
Put the given key-array pair into thetarget
map when thearray
is notnull
ornullIncluded
istrue
.Note that elements in the array are converted to
String
instances by thetoString()
method and added to a newList
instance, and theList
instance is put into thetarget
map.
-
put
public static void put(Map<String,Object> target, String baseKey, TaggedValue[] array, boolean nullIncluded)
Put"{baseKey}#{tag}"
properties into thetarget
map.
-
putJsonObject
public static void putJsonObject(Map<String,Object> target, String key, String json, boolean nullIncluded)
Convert the givenjson
into aMap
instance and put the instance into thetarget
map with thekey
.If
nullIncluded
istrue
, thekey
is put into thetarget
map even when the givenjson
isnull
.
-
putJsonArray
public static void putJsonArray(Map<String,Object> target, String key, String json, boolean nullIncluded)
Convert the givenjson
into aList
instance and put the instance into thetarget
map with thekey
.If
nullIncluded
istrue
, thekey
is put into thetarget
map even when the givenjson
isnull
.- Since:
- 3.55
-
-