in src/main/java/com/epam/eco/commons/kafka/serde/jackson/TopicPartitionJsonDeserializer.java [39:73]
public TopicPartition deserialize(
JsonParser jsonParser,
DeserializationContext ctxt) throws IOException {
if (jsonParser.getCurrentToken() == JsonToken.START_OBJECT) {
jsonParser.nextToken();
}
String fieldName = jsonParser.getCurrentName();
String topic = null;
Integer partition = null;
while (fieldName != null) {
if (TopicPartitionFields.TOPIC.equals(fieldName)) {
jsonParser.nextToken();
JsonToken currentToken = jsonParser.getCurrentToken();
if (currentToken == JsonToken.VALUE_STRING || currentToken == JsonToken.VALUE_NULL) {
topic = jsonParser.getValueAsString();
} else {
ctxt.reportInputMismatch(
_valueClass,
"Can't parse string value for '%s' field from '%s' token",
TopicPartitionFields.TOPIC, currentToken.name());
}
} else if (TopicPartitionFields.PARTITION.equals(fieldName)) {
jsonParser.nextToken();
partition = _parseIntPrimitive(jsonParser, ctxt);
} else {
handleUnknownProperty(jsonParser, ctxt, _valueClass, fieldName);
}
fieldName = jsonParser.nextFieldName();
}
com.epam.eco.commons.json.JsonDeserializerUtils.assertRequiredField(partition, TopicPartitionFields.PARTITION, _valueClass, ctxt);
return new TopicPartition(topic, partition);
}