Class AbstractJsonUtilImpl
java.lang.Object
org.apache.dubbo.common.json.impl.AbstractJsonUtilImpl
- All Implemented Interfaces:
JsonUtil
- Direct Known Subclasses:
FastJson2Impl,FastJsonImpl,GsonImpl,JacksonImpl
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncheckObjectList(List<?> rawList) Casts a list of unchecked JSON values to a list of checked objects in Java type.checkStringList(List<?> rawList) Casts a list of unchecked JSON values to a list of String.List<?> getListOfObjects(Map<String, ?> obj, String key) Gets a list from an object for the given key, and verifies all entries are objects.getListOfStrings(Map<String, ?> obj, String key) Gets a list from an object for the given key, and verifies all entries are strings.getNumberAsDouble(Map<String, ?> obj, String key) Gets a number from an object for the given key.getNumberAsInteger(Map<String, ?> obj, String key) Gets a number from an object for the given key, casted to an integer.getNumberAsLong(Map<String, ?> obj, String key) Gets a number from an object for the given key, casted to an long.Gets an object from an object for the given key.Gets a string from an object for the given key.booleanMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.dubbo.common.json.JsonUtil
toJavaList, toJavaObject, toJson
-
Constructor Details
-
AbstractJsonUtilImpl
public AbstractJsonUtilImpl()
-
-
Method Details
-
isSupport
public boolean isSupport() -
getList
-
getListOfObjects
Gets a list from an object for the given key, and verifies all entries are objects. If the key is not present, this returns null. If the value is not a List or an entry is not an object, throws an exception.- Specified by:
getListOfObjectsin interfaceJsonUtil
-
getListOfStrings
Gets a list from an object for the given key, and verifies all entries are strings. If the key is not present, this returns null. If the value is not a List or an entry is not a string, throws an exception.- Specified by:
getListOfStringsin interfaceJsonUtil
-
getObject
Gets an object from an object for the given key. If the key is not present, this returns null. If the value is not a Map, throws an exception. -
getNumberAsDouble
Gets a number from an object for the given key. If the key is not present, this returns null. If the value does not represent a double, throws an exception.- Specified by:
getNumberAsDoublein interfaceJsonUtil
-
getNumberAsInteger
Gets a number from an object for the given key, casted to an integer. If the key is not present, this returns null. If the value does not represent an integer, throws an exception.- Specified by:
getNumberAsIntegerin interfaceJsonUtil
-
getNumberAsLong
Gets a number from an object for the given key, casted to an long. If the key is not present, this returns null. If the value does not represent a long integer, throws an exception.- Specified by:
getNumberAsLongin interfaceJsonUtil
-
getString
Gets a string from an object for the given key. If the key is not present, this returns null. If the value is not a String, throws an exception. -
checkObjectList
Casts a list of unchecked JSON values to a list of checked objects in Java type. If the given list contains a value that is not a Map, throws an exception.- Specified by:
checkObjectListin interfaceJsonUtil
-
checkStringList
Casts a list of unchecked JSON values to a list of String. If the given list contains a value that is not a String, throws an exception.- Specified by:
checkStringListin interfaceJsonUtil
-