in store/src/main/java/com/epam/eco/schemacatalog/store/schema/kafka/SchemaRegistrySerde.java [55:77]
public static Key deserializeKey(byte[] keyBytes) throws SchemaRegistrySerdeException {
try {
KeyType keyType = extractKeyType(keyBytes);
if (keyType == KeyType.CONFIG) {
return MAPPER.readValue(keyBytes, ConfigKey.class);
} else if (keyType == KeyType.NOOP) {
return MAPPER.readValue(keyBytes, NoopKey.class);
} else if (keyType == KeyType.SCHEMA) {
return MAPPER.readValue(keyBytes, SchemaKey.class);
} else if (keyType == KeyType.DELETE_SUBJECT) {
return MAPPER.readValue(keyBytes, DeleteSubjectKey.class);
} else if (keyType == KeyType.MODE) {
return MAPPER.readValue(keyBytes, ModeKey.class);
} else if (keyType == KeyType.CLEAR_SUBJECT) {
return MAPPER.readValue(keyBytes, ClearSubjectKey.class);
} else {
throw new SchemaRegistrySerdeException(
String.format("Unsupported schema registry key type %s", keyType.name()));
}
} catch (IOException ioe) {
throw new SchemaRegistrySerdeException("Failed to deserialize schema registry key", ioe);
}
}