Package io.deephaven.kafka.ingest
Class JsonRecord
java.lang.Object
io.deephaven.kafka.ingest.JsonRecord
Provides convenience methods to facilitate parsing of a JSON String and extraction of typed values.
-
Constructor Summary
ConstructorsConstructorDescriptionJsonRecord
(io.deephaven.shadow.jackson.com.fasterxml.jackson.databind.JsonNode jsonNode) Encapsulates a JSONObject from which to retrieve Deephaven column values.JsonRecord
(io.deephaven.shadow.jackson.com.fasterxml.jackson.databind.JsonNode jsonNode, boolean allowMissingKeys, boolean allowNullValues, boolean allowCaseInsensitiveSearch) Encapsulates a JSONObject from which to retrieve Deephaven column values.JsonRecord
(String json) Encapsulates a JSONObject from which to retrieve Deephaven column values.JsonRecord
(String json, boolean allowMissingKeys, boolean allowNullValues, boolean allowCaseInsensitiveSearch) Encapsulates a JSONObject from which to retrieve Deephaven column values. -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
boolean
Returns a previously stored complex object, or null if not set by the builder.io.deephaven.shadow.jackson.com.fasterxml.jackson.databind.JsonNode
-
Constructor Details
-
JsonRecord
public JsonRecord(@NotNull String json, boolean allowMissingKeys, boolean allowNullValues, boolean allowCaseInsensitiveSearch) Encapsulates a JSONObject from which to retrieve Deephaven column values. Works in conjunction withJsonRecordUtil
.- Parameters:
json
- A string representation of the JSON object.allowMissingKeys
- If true, attempts to retrieve values that don't exist in the record will return a null or QueryConstants null primitive value; if false, the attempt will result in an InvalidArgumentException being thrown.allowNullValues
- If true, attempts to retrieve values that are null in the record will return a null or QueryConstants null primitive value; if false, the attempt will result in an InvalidArgumentException being thrown.allowCaseInsensitiveSearch
- If true, calls togetValue(String, Class)
will attempt a case-insensitive search to find a matching field in the JsonRecord.- Throws:
IllegalArgumentException
- if the JSON String cannot be parsed.
-
JsonRecord
public JsonRecord(@NotNull io.deephaven.shadow.jackson.com.fasterxml.jackson.databind.JsonNode jsonNode, boolean allowMissingKeys, boolean allowNullValues, boolean allowCaseInsensitiveSearch) Encapsulates a JSONObject from which to retrieve Deephaven column values. Works in conjunction withJsonRecordUtil
.- Parameters:
jsonNode
- A JsonNode to encapsulate.allowMissingKeys
- If true, attempts to retrieve values that don't exist in the record will return a null or QueryConstants null primitive value; if false, the attempt will result in an InvalidArgumentException being thrown.allowNullValues
- If true, attempts to retrieve values that are null in the record will return a null or QueryConstants null primitive value; if false, the attempt will result in an InvalidArgumentException being thrown.allowCaseInsensitiveSearch
- If true, calls togetValue(String, Class)
will attempt a case-insensitive search to find a matching field in the JsonRecord.- Throws:
IllegalArgumentException
- if the JSON String cannot be parsed.
-
JsonRecord
Encapsulates a JSONObject from which to retrieve Deephaven column values. Works in conjunction withJsonRecordUtil
.- Parameters:
json
- A string representation of the JSON object.- Throws:
IllegalArgumentException
- if the JSON String cannot be parsed.
-
JsonRecord
public JsonRecord(@NotNull io.deephaven.shadow.jackson.com.fasterxml.jackson.databind.JsonNode jsonNode) Encapsulates a JSONObject from which to retrieve Deephaven column values. Works in conjunction withJsonRecordUtil
.- Parameters:
jsonNode
- A JsonNode to encapsulate.- Throws:
IllegalArgumentException
- if the JSON String cannot be parsed.
-
-
Method Details
-
getRecord
public io.deephaven.shadow.jackson.com.fasterxml.jackson.databind.JsonNode getRecord() -
getAllowMissingKeys
public boolean getAllowMissingKeys()- Returns:
- A boolean indicating whether this JsonRecord allows requests for keys that are not in the field set.
-
getAllowNullValues
public boolean getAllowNullValues()- Returns:
- A boolean indicating whether this JsonRecord allows null values.
-
getCaseInsensitiveSearch
public boolean getCaseInsensitiveSearch()- Returns:
- A boolean indicating whether this JsonRecord will be searched for keys in a case-insensitive manner. All field names of the Json record must be unambiguous
-
getParsedObject
Returns a previously stored complex object, or null if not set by the builder.- Returns:
- an Object, which has been stored via
setParsedObject(Object)
-