类 DataMap
- 所有已实现的接口:
Serializable,Cloneable,InvocationHandler,Map<String,Object>
- 版本:
- 1.0.1
- 作者:
- YYJ
- 另请参阅:
-
嵌套类概要
从类继承的嵌套类/接口 java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidclear()clone()compute(String key, java.util.function.BiFunction<? super String, ? super Object, ?> remappingFunction) computeIfAbsent(String key, java.util.function.Function<? super String, ?> mappingFunction) computeIfPresent(String key, java.util.function.BiFunction<? super String, ? super Object, ?> remappingFunction) booleancontainsKey(Object key) Returns true if this map contains a mapping for the specified keybooleancontainsKey(String key) Returns true if this map contains a mapping for the specified keybooleancontainsValue(Object value) Returnstrueif this map maps one or more keys to the specified value.entrySet()Returns aSetview of the mappings contained in this map.eval(com.alibaba.fastjson2.JSONPath path) Chained addition of elementsvoidReturns the Object of the associated keys in thisDataMap.Returns the Object of the associated keys in thisDataMap.getBigDecimal(String key) Returns theBigDecimalof the associated keys in thisDataMap.getBigInteger(String key) Returns theBigIntegerof the associated keys in thisDataMap.getBoolean(String key) booleangetBooleanValue(String key) Returns a boolean value of the associated key in this object.booleangetBooleanValue(String key, boolean defaultValue) Returns a boolean value of the associated key in this object.bytegetByteValue(String key) Returns a byte value of the associated keys in thisDataMap.getCharSet(String name) getCharSet(String name, Charset defaultValue) getCharSetDef2$UTF8(String name, String defaultValue) getDataList(String key) getDataMap(String key) doublegetDoubleValue(String key) Returns a double value of the associated keys in thisDataMap.floatgetFloatValue(String key) Returns a float value of the associated keys in thisDataMap.java.time.InstantgetInstant(String key) Returns theBigIntegerof the associated keys in thisDataMap.getInteger(String key) intgetIntValue(String key) Returns an int value of the associated keys in thisDataMap.intgetIntValue(String key, int defaultValue) Returns an int value of the associated keys in thisDataMap.com.alibaba.fastjson2.JSONArraygetJSONArray(String key) Returns theJSONArrayof the associated keys in thisJSONObject.com.alibaba.fastjson2.JSONObjectgetJSONObject(String key) Returns theJSONObjectof the associated keys in thisJSONObject.<T> List<T>longgetLongValue(String key) Returns a long value of the associated keys in thisDataMap.longgetLongValue(String key, long defaultValue) Returns a long value of the associated keys in thisDataMap.<T> TgetObject(String key, com.alibaba.fastjson2.TypeReference<?> typeReference, com.alibaba.fastjson2.JSONReader.Feature... features) <T> T<T> T<T> TgetOrDefault(Object key, Object defaultValue) getOrDefault(String key, Object defaultValue) shortgetShortValue(String key) Returns a short value of the associated keys in thisDataMap.getString2(String name) getTimeUnit(String name) getTimeUnit(String name, TimeUnit defaultValue) booleanisEmpty()Returnstrueif this map contains no key-value mappings.booleanisValid(com.alibaba.fastjson2.schema.JSONSchema schema) keySet()Returns aSetview of the keys contained in this map.merge(String key, Object value, java.util.function.BiFunction<? super Object, ? super Object, ?> remappingFunction) voidnameFilter(com.alibaba.fastjson2.filter.NameFilter nameFilter) static DataMapof()static DataMapPack a pair of key-values asDataMapstatic DataMapPack two key-value pairs asDataMapstatic DataMapPack three key-value pairs asDataMapstatic DataMapPack three key-value pairs asDataMapstatic DataMapparseObject(String text) SeeparseObject(java.lang.String, java.lang.Class<T>)for detailsstatic <T> TparseObject(String text, com.alibaba.fastjson2.TypeReference<?> typeReference, com.alibaba.fastjson2.JSONReader.Feature... features) SeeparseObject(java.lang.String, java.lang.Class<T>)for detailsstatic <T> TparseObject(String text, Class<T> objectClass) SeeparseObject(java.lang.String, java.lang.Class<T>)for detailsstatic <T> TparseObject(String text, Class<T> objectClass, com.alibaba.fastjson2.JSONReader.Feature... features) SeeparseObject(java.lang.String, java.lang.Class<T>)for detailsstatic <T> TparseObject(String text, Type objectType, com.alibaba.fastjson2.JSONReader.Feature... features) SeeparseObject(java.lang.String, java.lang.Class<T>)for detailsvoidputIfAbsent(String key, Object value) Removes the mapping for the specified key from this map if present.booleanprotected booleanremoveEldestEntry(Map.Entry<String, Object> eldest) Returnstrueif this map should remove its eldest entry.booleanvoidreplaceAll(java.util.function.BiFunction<? super String, ? super Object, ?> function) intsize()Returns the number of key-value mappings in this map.<T> Tto(com.alibaba.fastjson2.TypeReference<?> typeReference, com.alibaba.fastjson2.JSONReader.Feature... features) Convert thisDataMapto the specified Object<T> TConvert thisDataMapto the specified Object<T> TConvert thisDataMapto the specified Object<T> Tto(java.util.function.Function<com.alibaba.fastjson2.JSONObject, T> function) <T> TtoJavaObject(com.alibaba.fastjson2.TypeReference<?> typeReference, com.alibaba.fastjson2.JSONReader.Feature... features) 已过时。<T> TtoJavaObject(Class<T> clazz, com.alibaba.fastjson2.JSONReader.Feature... features) 已过时。since 2.0.4, please useto(Class, JSONReader.Feature...)<T> TtoJavaObject(Type type, com.alibaba.fastjson2.JSONReader.Feature... features) 已过时。since 2.0.4, please useto(Type, JSONReader.Feature...)byte[]toJSONBBytes(com.alibaba.fastjson2.JSONWriter.Feature... features) Serialize to JSONB bytestoJSONString(com.alibaba.fastjson2.JSONWriter.Feature... features) Serialize to JSONStringtoString()toString(com.alibaba.fastjson2.JSONWriter.Feature... features) Serialize to JSONStringvoidvalueFilter(com.alibaba.fastjson2.filter.ValueFilter valueFilter) values()Returns aCollectionview of the values contained in this map.从类继承的方法 com.alibaba.fastjson2.JSONObject
toJSONString从类继承的方法 java.util.AbstractMap
equals, hashCode
-
构造器详细资料
-
DataMap
public DataMap() -
DataMap
-
DataMap
-
DataMap
-
DataMap
public DataMap(int initialCapacity) -
DataMap
public DataMap(int initialCapacity, float loadFactor) - 参数:
initialCapacity- the initial capacity = (number of elements to store / load factor) + 1loadFactor- the load factor- 抛出:
IllegalArgumentException- If the initial capacity is negative or the load factor is negative- 从以下版本开始:
- 2.0.2
-
DataMap
public DataMap(int initialCapacity, float loadFactor, boolean accessOrder) - 参数:
initialCapacity- the initial capacity = (number of elements to store / load factor) + 1loadFactor- the load factoraccessOrder- the ordering mode - true for access-order, false for insertion-order- 抛出:
IllegalArgumentException- If the initial capacity is negative or the load factor is negative- 从以下版本开始:
- 2.0.2
-
-
方法详细资料
-
get
Returns the Object of the associated keys in thisDataMap.- 覆盖:
get在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose associated value is to be returned
-
get
Returns the Object of the associated keys in thisDataMap. -
containsKey
Returns true if this map contains a mapping for the specified key- 覆盖:
containsKey在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose presence in this map is to be tested
-
containsKey
Returns true if this map contains a mapping for the specified key- 指定者:
containsKey在接口中Map<String,Object> - 覆盖:
containsKey在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose presence in this map is to be tested
-
getOrDefault
- 覆盖:
getOrDefault在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose associated value is to be returneddefaultValue- the default mapping of the key
-
getOrDefault
- 指定者:
getOrDefault在接口中Map<String,Object> - 覆盖:
getOrDefault在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose associated value is to be returneddefaultValue- the default mapping of the key- 从以下版本开始:
- 2.0.2
-
getDataList
- 参数:
key- the key whose associated value is to be returned- 返回:
DataListor null
-
getList
public <T> List<T> getList(String key, Class<T> itemClass, com.alibaba.fastjson2.JSONReader.Feature... features) - 覆盖:
getList在类中com.alibaba.fastjson2.JSONObject- 类型参数:
T- 泛型- 参数:
key- keyitemClass- 类型features- 选项- 返回:
- List
-
getDataMap
- 参数:
key- the key whose associated value is to be returned- 返回:
DataMapor null
-
getString
- 覆盖:
getString在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose associated value is to be returned- 返回:
Stringor null
-
getString2
-
getString
-
getDouble
- 覆盖:
getDouble在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose associated value is to be returned- 返回:
Doubleor null- 抛出:
NumberFormatException- If the value of get isStringand it contains no parsable doublecom.alibaba.fastjson2.JSONException- Unsupported type conversion toDouble
-
getDoubleValue
Returns a double value of the associated keys in thisDataMap.- 覆盖:
getDoubleValue在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose associated value is to be returned- 返回:
- double
- 抛出:
NumberFormatException- If the value of get isStringand it contains no parsable doublecom.alibaba.fastjson2.JSONException- Unsupported type conversion to double value
-
getFloat
- 覆盖:
getFloat在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose associated value is to be returned- 返回:
Floator null- 抛出:
NumberFormatException- If the value of get isStringand it contains no parsable floatcom.alibaba.fastjson2.JSONException- Unsupported type conversion toFloat
-
getFloatValue
Returns a float value of the associated keys in thisDataMap.- 覆盖:
getFloatValue在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose associated value is to be returned- 返回:
- float
- 抛出:
NumberFormatException- If the value of get isStringand it contains no parsable floatcom.alibaba.fastjson2.JSONException- Unsupported type conversion to float value
-
getLong
- 覆盖:
getLong在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose associated value is to be returned- 返回:
Longor null- 抛出:
NumberFormatException- If the value of get isStringand it contains no parsable longcom.alibaba.fastjson2.JSONException- Unsupported type conversion toLong
-
getLongValue
Returns a long value of the associated keys in thisDataMap.- 覆盖:
getLongValue在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose associated value is to be returned- 返回:
- long
- 抛出:
NumberFormatException- If the value of get isStringand it contains no parsable longcom.alibaba.fastjson2.JSONException- Unsupported type conversion to long value
-
getLongValue
Returns a long value of the associated keys in thisDataMap.- 覆盖:
getLongValue在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose associated value is to be returneddefaultValue- the default mapping of the key- 返回:
- long
- 抛出:
NumberFormatException- If the value of get isStringand it contains no parsable longcom.alibaba.fastjson2.JSONException- Unsupported type conversion to long value
-
getInteger
- 覆盖:
getInteger在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose associated value is to be returned- 返回:
Integeror null- 抛出:
NumberFormatException- If the value of get isStringand it contains no parsable intcom.alibaba.fastjson2.JSONException- Unsupported type conversion toInteger
-
getIntValue
Returns an int value of the associated keys in thisDataMap.- 覆盖:
getIntValue在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose associated value is to be returned- 返回:
- int
- 抛出:
NumberFormatException- If the value of get isStringand it contains no parsable intcom.alibaba.fastjson2.JSONException- Unsupported type conversion to int value
-
getIntValue
Returns an int value of the associated keys in thisDataMap.- 覆盖:
getIntValue在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose associated value is to be returneddefaultValue- the default mapping of the key- 返回:
- int
- 抛出:
NumberFormatException- If the value of get isStringand it contains no parsable intcom.alibaba.fastjson2.JSONException- Unsupported type conversion to int value
-
getShort
- 覆盖:
getShort在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose associated value is to be returned- 返回:
Shortor null- 抛出:
NumberFormatException- If the value of get isStringand it contains no parsable shortcom.alibaba.fastjson2.JSONException- Unsupported type conversion toShort
-
getShortValue
Returns a short value of the associated keys in thisDataMap.- 覆盖:
getShortValue在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose associated value is to be returned- 返回:
- short
- 抛出:
NumberFormatException- If the value of get isStringand it contains no parsable shortcom.alibaba.fastjson2.JSONException- Unsupported type conversion to short value
-
getByte
- 覆盖:
getByte在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose associated value is to be returned- 返回:
Byteor null- 抛出:
NumberFormatException- If the value of get isStringand it contains no parsable bytecom.alibaba.fastjson2.JSONException- Unsupported type conversion toByte
-
getByteValue
Returns a byte value of the associated keys in thisDataMap.- 覆盖:
getByteValue在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose associated value is to be returned- 返回:
- byte
- 抛出:
NumberFormatException- If the value of get isStringand it contains no parsable bytecom.alibaba.fastjson2.JSONException- Unsupported type conversion to byte value
-
getBoolean
-
getBooleanValue
Returns a boolean value of the associated key in this object.- 覆盖:
getBooleanValue在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose associated value is to be returned- 返回:
- boolean
- 抛出:
com.alibaba.fastjson2.JSONException- Unsupported type conversion to boolean value
-
getBooleanValue
Returns a boolean value of the associated key in this object.- 覆盖:
getBooleanValue在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose associated value is to be returneddefaultValue- the default mapping of the key- 返回:
- boolean
- 抛出:
com.alibaba.fastjson2.JSONException- Unsupported type conversion to boolean value
-
getBigInteger
Returns theBigIntegerof the associated keys in thisDataMap.- 覆盖:
getBigInteger在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose associated value is to be returned- 返回:
BigIntegeror null- 抛出:
com.alibaba.fastjson2.JSONException- Unsupported type conversion toBigIntegerNumberFormatException- If the value of get isStringand it is not a valid representation ofBigInteger
-
getBigDecimal
Returns theBigDecimalof the associated keys in thisDataMap.- 覆盖:
getBigDecimal在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose associated value is to be returned- 返回:
BigDecimalor null- 抛出:
com.alibaba.fastjson2.JSONException- Unsupported type conversion toBigDecimalNumberFormatException- If the value of get isStringand it is not a valid representation ofBigDecimal
-
getDate
- 覆盖:
getDate在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose associated value is to be returned- 返回:
Dateor null
-
getInstant
Returns theBigIntegerof the associated keys in thisDataMap.- 覆盖:
getInstant在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose associated value is to be returned- 返回:
BigIntegeror null
-
toString
Serialize to JSONString- 覆盖:
toString在类中com.alibaba.fastjson2.JSONObject- 参数:
features- features to be enabled in serialization- 返回:
- JSON
String
-
toJSONString
Serialize to JSONString- 覆盖:
toJSONString在类中com.alibaba.fastjson2.JSONObject- 参数:
features- features to be enabled in serialization- 返回:
- JSON
String
-
toJSONBBytes
public byte[] toJSONBBytes(com.alibaba.fastjson2.JSONWriter.Feature... features) Serialize to JSONB bytes- 覆盖:
toJSONBBytes在类中com.alibaba.fastjson2.JSONObject- 参数:
features- features to be enabled in serialization- 返回:
- JSONB bytes
-
to
public <T> T to(java.util.function.Function<com.alibaba.fastjson2.JSONObject, T> function) - 覆盖:
to在类中com.alibaba.fastjson2.JSONObject- 参数:
function-- 从以下版本开始:
- 2.0.4
-
to
Convert thisDataMapto the specified ObjectDataMap obj = ... Map<String, User> users = obj.to(new TypeReference<HashMap<String, User>>(){}.getType());- 覆盖:
to在类中com.alibaba.fastjson2.JSONObject- 参数:
type- specify theTypeto be convertedfeatures- features to be enabled in parsing- 从以下版本开始:
- 2.0.4
-
to
public <T> T to(com.alibaba.fastjson2.TypeReference<?> typeReference, com.alibaba.fastjson2.JSONReader.Feature... features) Convert thisDataMapto the specified ObjectDataMap obj = ... Map<String, User> users = obj.to(new TypeReference<HashMap<String, User>>(){});- 覆盖:
to在类中com.alibaba.fastjson2.JSONObject- 参数:
typeReference- specify theTypeReferenceto be convertedfeatures- features to be enabled in parsing- 从以下版本开始:
- 2.0.7
-
to
Convert thisDataMapto the specified ObjectDataMap obj = ... User user = obj.to(User.class);- 覆盖:
to在类中com.alibaba.fastjson2.JSONObject- 参数:
clazz- specify theClass<T>to be convertedfeatures- features to be enabled in parsing- 从以下版本开始:
- 2.0.4
-
toJavaObject
已过时。since 2.0.4, please useto(Class, JSONReader.Feature...)Convert thisDataMapto the specified Object- 覆盖:
toJavaObject在类中com.alibaba.fastjson2.JSONObject- 参数:
clazz- specify theClass<T>to be convertedfeatures- features to be enabled in parsing
-
toJavaObject
已过时。since 2.0.4, please useto(Type, JSONReader.Feature...)Convert thisDataMapto the specified Object- 覆盖:
toJavaObject在类中com.alibaba.fastjson2.JSONObject- 参数:
type- specify theTypeto be convertedfeatures- features to be enabled in parsing
-
toJavaObject
public <T> T toJavaObject(com.alibaba.fastjson2.TypeReference<?> typeReference, com.alibaba.fastjson2.JSONReader.Feature... features) 已过时。since 2.0.4, please useto(Type, JSONReader.Feature...)Convert thisDataMapto the specified Object- 覆盖:
toJavaObject在类中com.alibaba.fastjson2.JSONObject- 参数:
typeReference- specify theTypeReferenceto be convertedfeatures- features to be enabled in parsing
-
getObject
public <T> T getObject(String key, Class<T> type, com.alibaba.fastjson2.JSONReader.Feature... features) Returns the result of theTypeconverter conversion of the associated value in thisDataMap.User user = DataMap.getObject("user", User.class);- 覆盖:
getObject在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose associated value is to be returnedtype- specify theClassto be convertedfeatures-- 返回:
<T>or null- 抛出:
com.alibaba.fastjson2.JSONException- If no suitable conversion method is found
-
getObject
Returns the result of theTypeconverter conversion of the associated value in thisDataMap.User user = DataMap.getObject("user", User.class);- 覆盖:
getObject在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose associated value is to be returnedtype- specify theTypeto be convertedfeatures- features to be enabled in parsing- 返回:
<T>ornull- 抛出:
com.alibaba.fastjson2.JSONException- If no suitable conversion method is found
-
getObject
public <T> T getObject(String key, com.alibaba.fastjson2.TypeReference<?> typeReference, com.alibaba.fastjson2.JSONReader.Feature... features) Returns the result of theTypeconverter conversion of the associated value in thisDataMap.User user = DataMap.getObject("user", User.class);- 覆盖:
getObject在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose associated value is to be returnedtypeReference- specify theTypeReferenceto be convertedfeatures- features to be enabled in parsing- 返回:
<T>ornull- 抛出:
com.alibaba.fastjson2.JSONException- If no suitable conversion method is found- 从以下版本开始:
- 2.0.3
-
getObject
public <T> T getObject(String key, java.util.function.Function<com.alibaba.fastjson2.JSONObject, T> creator) - 覆盖:
getObject在类中com.alibaba.fastjson2.JSONObject- 参数:
key-creator-- 从以下版本开始:
- 2.0.4
-
invoke
- 指定者:
invoke在接口中InvocationHandler- 覆盖:
invoke在类中com.alibaba.fastjson2.JSONObject- 参数:
proxy- proxy object, currently uselessmethod- methods that need reflectionargs- parameters of invoke- 抛出:
UnsupportedOperationException- If reflection for this method is not supportedArrayIndexOutOfBoundsException- If the length of args does not match the length of the method parameterThrowable
-
fluentPut
Chained addition of elementsDataMap object = new DataMap().fluentPut("a", 1).fluentPut("b", 2).fluentPut("c", 3);- 覆盖:
fluentPut在类中com.alibaba.fastjson2.JSONObject- 参数:
key- key with which the specified value is to be associatedvalue- value to be associated with the specified key
-
isValid
public boolean isValid(com.alibaba.fastjson2.schema.JSONSchema schema) - 覆盖:
isValid在类中com.alibaba.fastjson2.JSONObject- 参数:
schema-- 从以下版本开始:
- 2.0.4
-
valueFilter
public void valueFilter(com.alibaba.fastjson2.filter.ValueFilter valueFilter) - 覆盖:
valueFilter在类中com.alibaba.fastjson2.JSONObject- 参数:
valueFilter-- 从以下版本开始:
- 2.0.3
-
nameFilter
public void nameFilter(com.alibaba.fastjson2.filter.NameFilter nameFilter) - 覆盖:
nameFilter在类中com.alibaba.fastjson2.JSONObject- 参数:
nameFilter-- 从以下版本开始:
- 2.0.3
-
eval
- 覆盖:
eval在类中com.alibaba.fastjson2.JSONObject- 参数:
path-- 返回:
-
containsValue
Returnstrueif this map maps one or more keys to the specified value.- 指定者:
containsValue在接口中Map<String,Object> - 覆盖:
containsValue在类中LinkedHashMap<String,Object> - 参数:
value- value whose presence in this map is to be tested- 返回:
trueif this map maps one or more keys to the specified value
-
clear
public void clear() -
removeEldestEntry
Returnstrueif this map should remove its eldest entry. This method is invoked byputandputAllafter inserting a new entry into the map. It provides the implementor with the opportunity to remove the eldest entry each time a new one is added. This is useful if the map represents a cache: it allows the map to reduce memory consumption by deleting stale entries.Sample use: this override will allow the map to grow up to 100 entries and then delete the eldest entry each time a new entry is added, maintaining a steady state of 100 entries.
private static final int MAX_ENTRIES = 100; protected boolean removeEldestEntry(Map.Entry eldest) { return size() > MAX_ENTRIES; }This method typically does not modify the map in any way, instead allowing the map to modify itself as directed by its return value. It is permitted for this method to modify the map directly, but if it does so, it must return
false(indicating that the map should not attempt any further modification). The effects of returningtrueafter modifying the map from within this method are unspecified.This implementation merely returns
false(so that this map acts like a normal map - the eldest element is never removed).- 覆盖:
removeEldestEntry在类中LinkedHashMap<String,Object> - 参数:
eldest- The least recently inserted entry in the map, or if this is an access-ordered map, the least recently accessed entry. This is the entry that will be removed it this method returnstrue. If the map was empty prior to theputorputAllinvocation resulting in this invocation, this will be the entry that was just inserted; in other words, if the map contains a single entry, the eldest entry is also the newest.- 返回:
trueif the eldest entry should be removed from the map;falseif it should be retained.
-
keySet
Returns aSetview of the keys contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's ownremoveoperation), the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via theIterator.remove,Set.remove,removeAll,retainAll, andclearoperations. It does not support theaddoraddAlloperations. ItsSpliteratortypically provides faster sequential performance but much poorer parallel performance than that ofHashMap. -
values
Returns aCollectionview of the values contained in this map. The collection is backed by the map, so changes to the map are reflected in the collection, and vice-versa. If the map is modified while an iteration over the collection is in progress (except through the iterator's ownremoveoperation), the results of the iteration are undefined. The collection supports element removal, which removes the corresponding mapping from the map, via theIterator.remove,Collection.remove,removeAll,retainAllandclearoperations. It does not support theaddoraddAlloperations. ItsSpliteratortypically provides faster sequential performance but much poorer parallel performance than that ofHashMap. -
entrySet
Returns aSetview of the mappings contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's ownremoveoperation, or through thesetValueoperation on a map entry returned by the iterator) the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via theIterator.remove,Set.remove,removeAll,retainAllandclearoperations. It does not support theaddoraddAlloperations. ItsSpliteratortypically provides faster sequential performance but much poorer parallel performance than that ofHashMap. -
forEach
-
replaceAll
- 指定者:
replaceAll在接口中Map<String,Object> - 覆盖:
replaceAll在类中LinkedHashMap<String,Object> - 参数:
function- the function to apply to each entry
-
size
public int size()Returns the number of key-value mappings in this map. -
isEmpty
public boolean isEmpty()Returnstrueif this map contains no key-value mappings. -
remove
Removes the mapping for the specified key from this map if present.- 指定者:
remove在接口中Map<String,Object> - 覆盖:
remove在类中HashMap<String,Object> - 参数:
key- key whose mapping is to be removed from the map- 返回:
- the previous value associated with
key, ornullif there was no mapping forkey. (Anullreturn can also indicate that the map previously associatednullwithkey.)
-
putIfAbsent
- 指定者:
putIfAbsent在接口中Map<String,Object> - 覆盖:
putIfAbsent在类中HashMap<String,Object> - 参数:
key- key with which the specified value is to be associatedvalue- value to be associated with the specified key- 返回:
-
remove
-
replace
-
replace
-
computeIfAbsent
public Object computeIfAbsent(String key, java.util.function.Function<? super String, ?> mappingFunction) This method will, on a best-effort basis, throw a
ConcurrentModificationExceptionif it is detected that the mapping function modifies this map during computation.- 指定者:
computeIfAbsent在接口中Map<String,Object> - 覆盖:
computeIfAbsent在类中HashMap<String,Object> - 参数:
key-mappingFunction-- 抛出:
ConcurrentModificationException- if it is detected that the mapping function modified this map
-
computeIfPresent
public Object computeIfPresent(String key, java.util.function.BiFunction<? super String, ? super Object, ?> remappingFunction) This method will, on a best-effort basis, throw a
ConcurrentModificationExceptionif it is detected that the remapping function modifies this map during computation.- 指定者:
computeIfPresent在接口中Map<String,Object> - 覆盖:
computeIfPresent在类中HashMap<String,Object> - 参数:
key-remappingFunction-- 抛出:
ConcurrentModificationException- if it is detected that the remapping function modified this map
-
compute
public Object compute(String key, java.util.function.BiFunction<? super String, ? super Object, ?> remappingFunction) This method will, on a best-effort basis, throw a
ConcurrentModificationExceptionif it is detected that the remapping function modifies this map during computation. -
getJSONArray
Returns theJSONArrayof the associated keys in thisJSONObject.- 覆盖:
getJSONArray在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose associated value is to be returned- 返回:
JSONArrayor null
-
getJSONObject
Returns theJSONObjectof the associated keys in thisJSONObject.- 覆盖:
getJSONObject在类中com.alibaba.fastjson2.JSONObject- 参数:
key- the key whose associated value is to be returned- 返回:
JSONObjector null
-
merge
public Object merge(String key, Object value, java.util.function.BiFunction<? super Object, ? super Object, ?> remappingFunction) This method will, on a best-effort basis, throw a
ConcurrentModificationExceptionif it is detected that the remapping function modifies this map during computation. -
getTimeUnit
- 参数:
name- 时间单位参数- 返回:
- 返回通用时间单位
-
getTimeUnit
- 参数:
name- 时间单位参数defaultValue- 默认值- 返回:
- 返回通用时间单位
-
getCharSet
-
getCharSet
-
getCharSetDef2$UTF8
-
getData
-
toString
- 覆盖:
toString在类中com.alibaba.fastjson2.JSONObject
-
clone
- 覆盖:
clone在类中com.alibaba.fastjson2.JSONObject
-
put
-
putAll
-
of
-
of
Pack a pair of key-values asDataMapDataMap DataMap = DataMap.of("name", "fastjson2");- 参数:
key- the key of the elementvalue- the value of the element
-
of
Pack two key-value pairs asDataMapDataMap DataMap = DataMap.of("key1", "value1", "key2", "value2");- 参数:
k1- first keyv1- first valuek2- second keyv2- second value- 从以下版本开始:
- 2.0.2
-
of
Pack three key-value pairs asDataMapDataMap DataMap = DataMap.of("key1", "value1", "key2", "value2", "key3", "value3");- 参数:
k1- first keyv1- first valuek2- second keyv2- second valuek3- third keyv3- third value- 从以下版本开始:
- 2.0.2
-
of
public static DataMap of(String k1, Object v1, String k2, Object v2, String k3, Object v3, String k4, Object v4) Pack three key-value pairs asDataMapDataMap DataMap = DataMap.of("key1", "value1", "key2", "value2", "key3", "value3");- 参数:
k1- first keyv1- first valuek2- second keyv2- second valuek3- third keyv3- third valuek4- third keyv4- third value- 从以下版本开始:
- 2.0.8
-
parseObject
SeeparseObject(java.lang.String, java.lang.Class<T>)for details -
parseObject
public static <T> T parseObject(String text, Class<T> objectClass, com.alibaba.fastjson2.JSONReader.Feature... features) SeeparseObject(java.lang.String, java.lang.Class<T>)for details -
parseObject
public static <T> T parseObject(String text, Type objectType, com.alibaba.fastjson2.JSONReader.Feature... features) SeeparseObject(java.lang.String, java.lang.Class<T>)for details -
parseObject
public static <T> T parseObject(String text, com.alibaba.fastjson2.TypeReference<?> typeReference, com.alibaba.fastjson2.JSONReader.Feature... features) SeeparseObject(java.lang.String, java.lang.Class<T>)for details -
parseObject
SeeparseObject(java.lang.String, java.lang.Class<T>)for details
-
to(Type, JSONReader.Feature...)