Package org.miaixz.bus.core.center.map
Class MapGets
java.lang.Object
org.miaixz.bus.core.center.map.MapValidator
org.miaixz.bus.core.center.map.MapGets
- Direct Known Subclasses:
MapKit
Map的getXXX封装,提供针对通用型的value按照所需类型获取值
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T获取Map指定key的值,并转换为指定类型static <T> T获取Map指定key的值,并转换为指定类型static <T> Tget(Map<?, ?> map, Object key, TypeReference<T> type) 获取Map指定key的值,并转换为指定类型static <T> Tget(Map<?, ?> map, Object key, TypeReference<T> type, T defaultValue) 获取Map指定key的值,并转换为指定类型static BooleangetBoolean(Map<?, ?> map, Object key) 获取Map指定key的值,并转换为Boolstatic BooleangetBoolean(Map<?, ?> map, Object key, Boolean defaultValue) 获取Map指定key的值,并转换为Boolstatic Character获取Map指定key的值,并转换为Characterstatic Character获取Map指定key的值,并转换为Characterstatic Date获取Map指定key的值,并转换为Datestatic Date获取Map指定key的值,并转换为Datestatic Double获取Map指定key的值,并转换为Doublestatic Double获取Map指定key的值,并转换为Doublestatic Float获取Map指定key的值,并转换为Floatstatic Float获取Map指定key的值,并转换为Floatstatic Integer获取Map指定key的值,并转换为Integerstatic Integer获取Map指定key的值,并转换为Integerstatic Long获取Map指定key的值,并转换为Longstatic Long获取Map指定key的值,并转换为Longstatic <T> TgetQuietly(Map<?, ?> map, Object key, Class<T> type, T defaultValue) 获取Map指定key的值,并转换为指定类型,此方法在转换失败后不抛异常,返回null。static <T> TgetQuietly(Map<?, ?> map, Object key, TypeReference<T> type, T defaultValue) 获取Map指定key的值,并转换为指定类型,转换失败后返回null,不抛异常static Short获取Map指定key的值,并转换为Shortstatic Short获取Map指定key的值,并转换为Shortstatic String获取Map指定key的值,并转换为字符串static String获取Map指定key的值,并转换为字符串Methods inherited from class org.miaixz.bus.core.center.map.MapValidator
emptyIfNull, isEmpty, isNotEmpty
-
Constructor Details
-
MapGets
public MapGets()
-
-
Method Details
-
getString
获取Map指定key的值,并转换为字符串- Parameters:
map- Mapkey- 键- Returns:
- 值
-
getString
获取Map指定key的值,并转换为字符串- Parameters:
map- Mapkey- 键defaultValue- 默认值- Returns:
- 值
-
getInt
获取Map指定key的值,并转换为Integer- Parameters:
map- Mapkey- 键- Returns:
- 值
-
getInt
获取Map指定key的值,并转换为Integer- Parameters:
map- Mapkey- 键defaultValue- 默认值- Returns:
- 值
-
getDouble
获取Map指定key的值,并转换为Double- Parameters:
map- Mapkey- 键- Returns:
- 值
-
getDouble
获取Map指定key的值,并转换为Double- Parameters:
map- Mapkey- 键defaultValue- 默认值- Returns:
- 值
-
getFloat
获取Map指定key的值,并转换为Float- Parameters:
map- Mapkey- 键- Returns:
- 值
-
getFloat
获取Map指定key的值,并转换为Float- Parameters:
map- Mapkey- 键defaultValue- 默认值- Returns:
- 值
-
getShort
获取Map指定key的值,并转换为Short- Parameters:
map- Mapkey- 键- Returns:
- 值
-
getShort
获取Map指定key的值,并转换为Short- Parameters:
map- Mapkey- 键defaultValue- 默认值- Returns:
- 值
-
getBoolean
获取Map指定key的值,并转换为Bool- Parameters:
map- Mapkey- 键- Returns:
- 值
-
getBoolean
获取Map指定key的值,并转换为Bool- Parameters:
map- Mapkey- 键defaultValue- 默认值- Returns:
- 值
-
getChar
获取Map指定key的值,并转换为Character- Parameters:
map- Mapkey- 键- Returns:
- 值
-
getChar
获取Map指定key的值,并转换为Character- Parameters:
map- Mapkey- 键defaultValue- 默认值- Returns:
- 值
-
getLong
获取Map指定key的值,并转换为Long- Parameters:
map- Mapkey- 键- Returns:
- 值
-
getLong
获取Map指定key的值,并转换为Long- Parameters:
map- Mapkey- 键defaultValue- 默认值- Returns:
- 值
-
getDate
获取Map指定key的值,并转换为Date- Parameters:
map- Mapkey- 键- Returns:
- 值
-
getDate
获取Map指定key的值,并转换为Date- Parameters:
map- Mapkey- 键defaultValue- 默认值- Returns:
- 值
-
get
获取Map指定key的值,并转换为指定类型- Type Parameters:
T- 目标值类型- Parameters:
map- Mapkey- 键type- 值类型- Returns:
- 值
-
get
获取Map指定key的值,并转换为指定类型- Type Parameters:
T- 目标值类型- Parameters:
map- Mapkey- 键type- 值类型defaultValue- 默认值- Returns:
- 值
-
getQuietly
获取Map指定key的值,并转换为指定类型,此方法在转换失败后不抛异常,返回null。- Type Parameters:
T- 目标值类型- Parameters:
map- Mapkey- 键type- 值类型defaultValue- 默认值- Returns:
- 值
-
get
获取Map指定key的值,并转换为指定类型- Type Parameters:
T- 目标值类型- Parameters:
map- Mapkey- 键type- 值类型- Returns:
- 值
-
get
获取Map指定key的值,并转换为指定类型- Type Parameters:
T- 目标值类型- Parameters:
map- Mapkey- 键type- 值类型defaultValue- 默认值- Returns:
- 值
-
getQuietly
获取Map指定key的值,并转换为指定类型,转换失败后返回null,不抛异常- Type Parameters:
T- 目标值类型- Parameters:
map- Mapkey- 键type- 值类型defaultValue- 默认值- Returns:
- 值
-