Class JsonLongAttributeResponseParser
- java.lang.Object
-
- com.cognite.client.servicesV1.response.JsonLongAttributeResponseParser
-
- All Implemented Interfaces:
ResponseParser<Long>
,Serializable
public abstract class JsonLongAttributeResponseParser extends Object implements ResponseParser<Long>, Serializable
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 class
JsonLongAttributeResponseParser.Builder
-
Field Summary
Fields Modifier and Type Field Description protected org.slf4j.Logger
LOG
-
Constructor Summary
Constructors Constructor Description JsonLongAttributeResponseParser()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static JsonLongAttributeResponseParser
create()
com.google.common.collect.ImmutableList<Long>
extractItems(byte[] payload)
Extract the results items from a response body.com.google.common.collect.ImmutableList<Long>
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.abstract String
getAttributePath()
abstract JsonLongAttributeResponseParser.Builder
toBuilder()
JsonLongAttributeResponseParser
withAttributePath(String path)
Sets the path to the attribute to extract.
-
-
-
Method Detail
-
create
public static JsonLongAttributeResponseParser create()
-
toBuilder
public abstract JsonLongAttributeResponseParser.Builder toBuilder()
-
getAttributePath
public abstract String getAttributePath()
-
withAttributePath
public JsonLongAttributeResponseParser withAttributePath(String path)
Sets the path to the attribute to extract.- Parameters:
path
-- Returns:
-
extractNextCursor
public Optional<String> extractNextCursor(byte[] payload) throws Exception
Extract the next cursor from a response body.- Specified by:
extractNextCursor
in interfaceResponseParser<Long>
- Parameters:
payload
- The reponse body- Returns:
- Throws:
Exception
IOException
-
extractNextCursor
public Optional<String> extractNextCursor(String json)
Extract the next cursor from a results json payload. Will always return an empty Optional.- Parameters:
json
- The results json payload- Returns:
- Throws:
IOException
-
extractItems
public com.google.common.collect.ImmutableList<Long> extractItems(byte[] payload) throws Exception
Extract the results items from a response body.- Specified by:
extractItems
in interfaceResponseParser<Long>
- Parameters:
payload
- The reponse body- Returns:
- Throws:
Exception
-
extractItems
public com.google.common.collect.ImmutableList<Long> extractItems(String json) throws Exception
Extract the main items from a results json payload. Returns the entire payload as a json string.- Parameters:
json
- The results json payload- Returns:
- Throws:
IOException
Exception
-
-