java.lang.Object
com.github.wnameless.json.base.JsonValueUtils
JsonValueUtils provides convenient methods to generate Java objects from any JSON wrapper
in this library.- Author:
- Wei-Ming Wu
-
Method Summary
Modifier and TypeMethodDescriptionstatic NumberCreates aNumberby givenBigDecimalfromInteger,Long,BigInteger,DoubleandBigDecimalbased on the size and scale of numeric.toList(JsonArrayBase<?> jsonArray) Creates aListby givenJsonArrayBase.toMap(JsonObjectBase<?> jsonObject) Creates aMapby givenJsonObjectBase.static ObjecttoObject(JsonValueBase<?> jsonValue) Creates a JavaObjectfrom givenJsonValueBase.
-
Method Details
-
toObject
Creates a JavaObjectfrom givenJsonValueBase.- Parameters:
jsonValue- aJsonValueBase- Returns:
- an
Objectcorresponds to JSON value - Throws:
IllegalStateException- if givenJsonValueBaseis not represented as any JSON value
-
toJavaNumber
Creates aNumberby givenBigDecimalfromInteger,Long,BigInteger,DoubleandBigDecimalbased on the size and scale of numeric.- Parameters:
bd- aBigDecimal- Returns:
- a
Number
-
toList
Creates aListby givenJsonArrayBase.- Parameters:
jsonArray- aJsonArrayBase- Returns:
- a
List
-
toMap
Creates aMapby givenJsonObjectBase.- Parameters:
jsonObject- aJsonObjectBase- Returns:
- a
Map
-