public class GenericJsonConfigurationHelper<J> extends Object implements ConfigurationHelper<J>
| Modifier and Type | Method and Description |
|---|---|
Object |
get(String jsonPath)
Returns the object associated with the specified @code jsonPath} in the JSON document
in context.
|
J |
getBean()
Returns the configuration bean used by this data retriever, typically for manual
handling and/or troubleshooting purposes.
|
Boolean |
getBoolean(String jsonPath)
Returns the
Boolean object associated with the specified jsonPath in
the JsonNode in context, provided that the expression returns a single element
that can be mapped to boolean. |
Double |
getDouble(String jsonPath)
Returns the
Double object associated with the specified jsonPath in the
JsonNode in context, provided that the expression returns a single element that
can be mapped to double. |
Integer |
getInteger(String jsonPath)
Returns the
Integer object associated with the specified jsonPath in
the JsonNode in context, provided that the expression returns a single element
that can be mapped to int. |
Long |
getLong(String jsonPath)
Returns the
Long object associated with the specified jsonPath in the
JsonNode in context, provided that the expression returns a single element that
can be mapped to long. |
Boolean |
getMandatoryBoolean(String jsonPath)
Returns the
Boolean object associated with the specified jsonPath in
the JsonNode in context, provided that the expression returns a single element
that can be mapped to boolean. |
Double |
getMandatoryDouble(String jsonPath)
Returns the
Double object associated with the specified jsonPath in the
JsonNode in context, provided that the expression returns a single element that
can be mapped to double. |
Integer |
getMandatoryInteger(String jsonPath)
Returns the
Integer object associated with the specified jsonPath in
the JsonNode in context, provided that the expression returns a single element
that can be mapped to int. |
Long |
getMandatoryLong(String jsonPath)
Returns the
Long object associated with the specified jsonPath in the
JsonNode in context, provided that the expression returns a single element that
can be mapped to long. |
String |
getMandatoryString(String jsonPath)
Returns the
String object associated with the specified jsonPath in the
JsonNode in context, provided that the expression returns a single element. |
String |
getString(String jsonPath)
Returns the
String object associated with the specified jsonPath in the
JsonNode in context, provided that the expression returns a single element. |
public J getBean()
ConfigurationDataRetrievergetBean in interface ConfigurationDataRetriever<J>public Boolean getBoolean(String jsonPath)
Boolean object associated with the specified jsonPath in
the JsonNode in context, provided that the expression returns a single element
that can be mapped to boolean.getBoolean in interface ConfigurationDataRetriever<J>jsonPath - the path to readBoolean object associated with the specified jsonPath;
null if the path is not foundIllegalArgumentException - if jsonPath is null or emptycom.jayway.jsonpath.InvalidPathException - if the jsonPath expression is not validConfigurationException - if the jsonPath expression returns more than a
single elementClassCastException - if the jsonPath result cannot be assigned to
booleanpublic Boolean getMandatoryBoolean(String jsonPath)
Boolean object associated with the specified jsonPath in
the JsonNode in context, provided that the expression returns a single element
that can be mapped to boolean.getMandatoryBoolean in interface ConfigurationDataRetriever<J>jsonPath - the path to readBoolean object associated with the specified jsonPath;
never nullIllegalArgumentException - if jsonPath is null or emptycom.jayway.jsonpath.InvalidPathException - if the jsonPath expression is not validConfigurationException - if not value found or the jsonPath expression
returns more than a single elementClassCastException - if the jsonPath result cannot be assigned to
booleanpublic Integer getInteger(String jsonPath)
Integer object associated with the specified jsonPath in
the JsonNode in context, provided that the expression returns a single element
that can be mapped to int.getInteger in interface ConfigurationDataRetriever<J>jsonPath - the path to readInteger object associated with the specified jsonPath;
null if the path is not foundIllegalArgumentException - if jsonPath is null or emptycom.jayway.jsonpath.InvalidPathException - if the jsonPath expression is not validConfigurationException - if the jsonPath expression returns more than a
single elementClassCastException - if the jsonPath result cannot be assigned to
intpublic Integer getMandatoryInteger(String jsonPath)
Integer object associated with the specified jsonPath in
the JsonNode in context, provided that the expression returns a single element
that can be mapped to int.getMandatoryInteger in interface ConfigurationDataRetriever<J>jsonPath - the path to readInteger object associated with the specified jsonPath;
never nullIllegalArgumentException - if jsonPath is null or emptycom.jayway.jsonpath.InvalidPathException - if the jsonPath expression is not validConfigurationException - if not value found or the jsonPath expression
returns more than a single elementClassCastException - if the jsonPath result cannot be assigned to
intpublic Long getLong(String jsonPath)
Long object associated with the specified jsonPath in the
JsonNode in context, provided that the expression returns a single element that
can be mapped to long.getLong in interface ConfigurationDataRetriever<J>jsonPath - the path to readLong object associated with the specified jsonPath;
null if the path is not foundIllegalArgumentException - if jsonPath is null or emptycom.jayway.jsonpath.InvalidPathException - if the jsonPath expression is not validConfigurationException - if the jsonPath expression returns more than a
single elementClassCastException - if the jsonPath result cannot be assigned to
longpublic Long getMandatoryLong(String jsonPath)
Long object associated with the specified jsonPath in the
JsonNode in context, provided that the expression returns a single element that
can be mapped to long.getMandatoryLong in interface ConfigurationDataRetriever<J>jsonPath - the path to readLong object associated with the specified jsonPath; never
nullIllegalArgumentException - if jsonPath is null or emptycom.jayway.jsonpath.InvalidPathException - if the jsonPath expression is not validConfigurationException - if not value found or the jsonPath expression
returns more than a single elementClassCastException - if the jsonPath result cannot be assigned to
longpublic Double getDouble(String jsonPath)
Double object associated with the specified jsonPath in the
JsonNode in context, provided that the expression returns a single element that
can be mapped to double.getDouble in interface ConfigurationDataRetriever<J>jsonPath - the path to readDouble object associated with the specified jsonPath;
null if the path is not foundIllegalArgumentException - if jsonPath is null or emptycom.jayway.jsonpath.InvalidPathException - if the jsonPath expression is not validConfigurationException - if the jsonPath expression returns more than a
single elementClassCastException - if the jsonPath result cannot be assigned to
doublepublic Double getMandatoryDouble(String jsonPath)
Double object associated with the specified jsonPath in the
JsonNode in context, provided that the expression returns a single element that
can be mapped to double.getMandatoryDouble in interface ConfigurationDataRetriever<J>jsonPath - the path to readDouble object associated with the specified jsonPath; never
nullIllegalArgumentException - if jsonPath is null or emptycom.jayway.jsonpath.InvalidPathException - if the jsonPath expression is not validConfigurationException - if not value found or the jsonPath expression
returns more than a single elementClassCastException - if the jsonPath result cannot be assigned to
doublepublic String getString(String jsonPath)
String object associated with the specified jsonPath in the
JsonNode in context, provided that the expression returns a single element.getString in interface ConfigurationDataRetriever<J>jsonPath - the path to readString object associated with the specified jsonPath;
null if the path is not foundIllegalArgumentException - if jsonPath is null or emptycom.jayway.jsonpath.InvalidPathException - if the jsonPath expression is not validConfigurationException - if the jsonPath expression returns more than a
single elementpublic String getMandatoryString(String jsonPath)
String object associated with the specified jsonPath in the
JsonNode in context, provided that the expression returns a single element.getMandatoryString in interface ConfigurationDataRetriever<J>jsonPath - the path to readString value associated with the specified jsonPath; never
nullIllegalArgumentException - if jsonPath is null or emptycom.jayway.jsonpath.InvalidPathException - if the jsonPath expression is not validConfigurationException - if not value found or the jsonPath expression
returns more than a single elementpublic Object get(String jsonPath)
Note: The actual return type may vary depending on the JSON implementation, but usually it should be an array.
get in interface ConfigurationDataRetriever<J>jsonPath - the path to readkey; or an empty array if the
path is not foundIllegalArgumentException - if jsonPath is null or emptycom.jayway.jsonpath.InvalidPathException - if the jsonPath expression is not validCopyright © 2022. All rights reserved.