Перенос из 3 лабы
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package org.example.config;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class StrictStringDeserializer extends JsonDeserializer<String> {
|
||||
|
||||
@Override
|
||||
public String deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
|
||||
if (p.currentToken() != JsonToken.VALUE_STRING) {
|
||||
return (String) ctxt.handleUnexpectedToken(String.class, p);
|
||||
}
|
||||
return p.getValueAsString();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user