2021-11-26 18:23:44 +01:00
|
|
|
package io.volvox.chats;
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.core.JsonParser;
|
|
|
|
import com.fasterxml.jackson.databind.DeserializationContext;
|
|
|
|
import com.fasterxml.jackson.databind.JsonDeserializer;
|
|
|
|
import java.io.IOException;
|
|
|
|
|
2021-12-01 14:23:42 +01:00
|
|
|
public class ChatIdJsonDeserializer extends JsonDeserializer<ChatId> {
|
2021-11-26 18:23:44 +01:00
|
|
|
|
|
|
|
@Override
|
2021-12-01 14:23:42 +01:00
|
|
|
public ChatId deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
|
2021-11-26 18:23:44 +01:00
|
|
|
var id = p.readValueAs(String.class);
|
2021-12-01 14:23:42 +01:00
|
|
|
return ChatId.fromString(id);
|
2021-11-26 18:23:44 +01:00
|
|
|
}
|
|
|
|
}
|