public class JSONObjectHelper extends AbstractBasicConfigurationHelper<org.json.JSONObject>
JSONObject, with JSONPath capabilities.| Constructor and Description |
|---|
JSONObjectHelper(org.json.JSONObject jsonObject)
Creates a new helper for the given
JSONObject. |
| Modifier and Type | Method and Description |
|---|---|
Optional<org.json.JSONObject> |
getBean() |
boolean |
getBoolean(String jsonPath)
Returns the
boolean value associated with the specified jsonPath in the
JSONObject in context, provided that the expression returns a single element
that can be mapped to boolean. |
double |
getDouble(String jsonPath)
Returns the
double value associated with the specified jsonPath in the
JSONObject in context, provided that the expression returns a single element
that can be mapped to double. |
int |
getInt(String jsonPath)
Returns the
int value associated with the specified jsonPath in the
JSONObject in context, provided that the expression returns a single element
that can be mapped to int. |
long |
getLong(String jsonPath)
Returns the
long value associated with the specified jsonPath in the
JSONObject in context, provided that the expression returns a single element
that can be mapped to long. |
String |
getString(String jsonPath)
Returns the
String value associated with the specified jsonPath in the
JSONObject in context, provided that the expression returns a single element. |
setNullValueProviderpublic JSONObjectHelper(org.json.JSONObject jsonObject)
JSONObject.jsonObject - the JSON object to be setpublic Optional<org.json.JSONObject> getBean()
JSONObject in contextpublic boolean getBoolean(String jsonPath)
boolean value associated with the specified jsonPath in the
JSONObject in context, provided that the expression returns a single element
that can be mapped to boolean.jsonPath - the path to readboolean value associated with the specified jsonPathConfigurationException - if the jsonPath expression returns more than a
single elementClassCastException - if the jsonPath result cannot be assigned to
booleanpublic int getInt(String jsonPath)
int value associated with the specified jsonPath in the
JSONObject in context, provided that the expression returns a single element
that can be mapped to int.jsonPath - the path to readint value associated with the specified jsonPathConfigurationException - if the jsonPath expression returns more than a
single elementClassCastException - if the jsonPath result cannot be assigned to
intpublic long getLong(String jsonPath)
long value associated with the specified jsonPath in the
JSONObject in context, provided that the expression returns a single element
that can be mapped to long.jsonPath - the path to readlong value associated with the specified jsonPathConfigurationException - if the jsonPath expression returns more than a
single elementClassCastException - if the jsonPath result cannot be assigned to
longpublic double getDouble(String jsonPath)
double value associated with the specified jsonPath in the
JSONObject in context, provided that the expression returns a single element
that can be mapped to double.jsonPath - the path to readdouble value associated with the specified jsonPathConfigurationException - if the jsonPath expression returns more than a
single elementClassCastException - if the jsonPath result cannot be assigned to
doublepublic String getString(String jsonPath)
String value associated with the specified jsonPath in the
JSONObject in context, provided that the expression returns a single element.jsonPath - the path to readString value associated with the specified jsonPathConfigurationException - if the jsonPath expression returns more than a
single elementCopyright © 2021. All rights reserved.