Class JsonRecord

java.lang.Object
io.deephaven.kafka.ingest.JsonRecord

public class JsonRecord
extends Object
Provides convenience methods to facilitate parsing of a JSON String and extraction of typed values.
  • Constructor Summary

    Constructors 
    Constructor Description
    JsonRecord​(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 Type Method Description
    boolean getAllowMissingKeys()  
    boolean getAllowNullValues()  
    boolean getCaseInsensitiveSearch()  
    io.deephaven.shadow.jackson.com.fasterxml.jackson.databind.JsonNode getRecord()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 with JsonRecordUtil.
      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 to getValue(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 with JsonRecordUtil.
      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 to getValue(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 String json)
      Encapsulates a JSONObject from which to retrieve Deephaven column values. Works in conjunction with JsonRecordUtil.
      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 with JsonRecordUtil.
      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