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 theitemsnode and next cursor from thenextCursornode.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected StringinstanceIdprotected org.slf4j.LoggerLOGprotected static intMAX_LENGTH_JSON_LOGprotected com.fasterxml.jackson.databind.ObjectMapperobjectMapper
-
Constructor Summary
Constructors Constructor Description DefaultResponseParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.common.collect.ImmutableList<String>extractItems(byte[] payload)Extract the results items from a response body.com.google.common.collect.ImmutableList<String>extractItems(String json)Extract the main items from a results json payload.Optional<String>extractNextCursor(byte[] payload)Extract the next cursor from a response body.Optional<String>extractNextCursor(String json)Extract the next cursor from a results json payload.protected StringparseToString(byte[] payload)
-
-
-
Field Detail
-
MAX_LENGTH_JSON_LOG
protected static final int MAX_LENGTH_JSON_LOG
- See Also:
- Constant Field Values
-
LOG
protected final org.slf4j.Logger LOG
-
objectMapper
protected final com.fasterxml.jackson.databind.ObjectMapper objectMapper
-
instanceId
protected final String instanceId
-
-
Method Detail
-
extractNextCursor
public Optional<String> extractNextCursor(byte[] payload) throws Exception
Extract the next cursor from a response body.- Specified by:
extractNextCursorin interfaceResponseParser<String>- Parameters:
payload- The reponse body- Returns:
- Throws:
ExceptionIOException
-
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:
IOExceptionException
-
extractItems
public com.google.common.collect.ImmutableList<String> extractItems(byte[] payload) throws Exception
Extract the results items from a response body.- Specified by:
extractItemsin interfaceResponseParser<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:
IOExceptionException
-
parseToString
protected String parseToString(byte[] payload)
-
-