Class DefaultResponseParser

java.lang.Object
com.cognite.client.servicesV1.response.DefaultResponseParser
All Implemented Interfaces:
ResponseParser<String>, Serializable
Direct Known Subclasses:
FileUploadHeaderResponseParser, JsonDataItemResponseParser, JsonErrorItemResponseParser, JsonErrorMessageDuplicateResponseParser, JsonItemResponseParser, JsonRawRowResponseParser, JsonResponseParser, JsonStringAttributeResponseParser, JsonThreeDOutputsParser, TSPointsResponseParser

public abstract class DefaultResponseParser extends Object implements ResponseParser<String>, Serializable
The default response parser extracts results items from the items node and next cursor from the nextCursor node.
See Also:
  • Field Details

    • MAX_LENGTH_JSON_LOG

      protected static final int MAX_LENGTH_JSON_LOG
      See Also:
    • LOG

      protected final org.slf4j.Logger LOG
    • objectMapper

      protected final com.fasterxml.jackson.databind.ObjectMapper objectMapper
    • instanceId

      protected final String instanceId
  • Constructor Details

    • DefaultResponseParser

      public DefaultResponseParser()
  • Method Details

    • extractNextCursor

      public Optional<String> extractNextCursor(byte[] payload) throws Exception
      Extract the next cursor from a response body.
      Specified by:
      extractNextCursor in interface ResponseParser<String>
      Parameters:
      payload - The reponse body
      Returns:
      Throws:
      Exception
      IOException
    • extractNextCursor

      public Optional<String> extractNextCursor(String json) throws Exception
      Extract the next cursor from a results json payload.
      Parameters:
      json - The results json payload
      Returns:
      Throws:
      IOException
      Exception
    • extractItems

      public com.google.common.collect.ImmutableList<String> extractItems(byte[] payload) throws Exception
      Extract the results items from a response body.
      Specified by:
      extractItems in interface ResponseParser<String>
      Parameters:
      payload - The reponse body
      Returns:
      Throws:
      Exception
    • extractItems

      public com.google.common.collect.ImmutableList<String> extractItems(String json) throws Exception
      Extract the main items from a results json payload.
      Parameters:
      json - The results json payload
      Returns:
      Throws:
      IOException
      Exception
    • parseToString

      protected String parseToString(byte[] payload)