Class JsonStringAttributeResponseParser
- java.lang.Object
-
- com.cognite.client.servicesV1.response.DefaultResponseParser
-
- com.cognite.client.servicesV1.response.JsonStringAttributeResponseParser
-
- All Implemented Interfaces:
ResponseParser<String>,Serializable
public abstract class JsonStringAttributeResponseParser extends DefaultResponseParser
Parses a single attribute from a json payload as a single item. A cursor is never returned from this parser.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJsonStringAttributeResponseParser.Builder
-
Field Summary
-
Fields inherited from class com.cognite.client.servicesV1.response.DefaultResponseParser
instanceId, LOG, MAX_LENGTH_JSON_LOG, objectMapper
-
-
Constructor Summary
Constructors Constructor Description JsonStringAttributeResponseParser()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static JsonStringAttributeResponseParsercreate()com.google.common.collect.ImmutableList<String>extractItems(String json)Extract the main items from a results json payload.Optional<String>extractNextCursor(String json)Extract the next cursor from a results json payload.abstract List<String>getAttributePath()JsonStringAttributeResponseParserwithAttributePath(String path)Sets the path to the attribute to extract.-
Methods inherited from class com.cognite.client.servicesV1.response.DefaultResponseParser
extractItems, extractNextCursor, parseToString
-
-
-
-
Method Detail
-
create
public static JsonStringAttributeResponseParser create()
-
withAttributePath
public JsonStringAttributeResponseParser withAttributePath(String path)
Sets the path to the attribute to extract.- Parameters:
path-- Returns:
-
extractNextCursor
public Optional<String> extractNextCursor(String json)
Extract the next cursor from a results json payload. Will always return an empty Optional.- Overrides:
extractNextCursorin classDefaultResponseParser- Parameters:
json- The results json payload- Returns:
- Throws:
IOException
-
extractItems
public com.google.common.collect.ImmutableList<String> extractItems(String json) throws Exception
Extract the main items from a results json payload. Returns the entire payload as a json string.- Overrides:
extractItemsin classDefaultResponseParser- Parameters:
json- The results json payload- Returns:
- Throws:
IOExceptionIOExceptionException
-
-