Class Dict
- All Implemented Interfaces:
Serializable, Cloneable, Map<String,Object>, SequencedMap<String, Object>
便捷字典类,参考 Hutool 的
Dict 设计。
以字符串为键的 LinkedHashMap,提供类型化取值方法,常用于组装参数或临时数据载体。- Since:
- 0.1.0
- Author:
- suretool
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetBigDecimal(String key) 获取 BigDecimal 值。getBigDecimal(String key, BigDecimal defaultValue) 获取 BigDecimal 值,缺失或转换失败返回默认值。getBigInteger(String key) 获取 BigInteger 值。getBigInteger(String key, BigInteger defaultValue) 获取 BigInteger 值,缺失或转换失败返回默认值。获取布尔值(支持true/false、1/0、yes/no、是/否等)。获取浮点值。获取整数值(支持数字类型与字符串转换)。获取长整数值。获取字符串值。获取字符串值,不存在或为空返回默认值。static Dict创建字典并快速填充键值对(键值交替)。设置键值对并返回自身(支持链式调用)。Methods inherited from class LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, newLinkedHashMap, putFirst, putLast, removeEldestEntry, replaceAll, reversed, sequencedEntrySet, sequencedKeySet, sequencedValues, valuesMethods inherited from class HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, newHashMap, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeMethods inherited from class AbstractMap
equals, hashCode, toStringMethods inherited from interface Map
compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeMethods inherited from interface SequencedMap
firstEntry, lastEntry, pollFirstEntry, pollLastEntry
-
Constructor Details
-
Dict
public Dict()
-
-
Method Details
-
of
-
set
-
getStr
-
getStr
-
getInt
-
getLong
-
getBigDecimal
获取 BigDecimal 值。- Parameters:
key- 键- Returns:
- BigDecimal,不存在或无法转换返回
null
-
getBigDecimal
获取 BigDecimal 值,缺失或转换失败返回默认值。- Parameters:
key- 键defaultValue- 默认值- Returns:
- BigDecimal 或默认值
-
getBigInteger
获取 BigInteger 值。- Parameters:
key- 键- Returns:
- BigInteger,不存在或无法转换返回
null
-
getBigInteger
获取 BigInteger 值,缺失或转换失败返回默认值。- Parameters:
key- 键defaultValue- 默认值- Returns:
- BigInteger 或默认值
-
getDouble
-
getBool
-