
no.whirlwin.jsonpatch.OpValidator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of json-patch Show documentation
Show all versions of json-patch Show documentation
Java JSON patch implementation
The newest version!
package no.whirlwin.jsonpatch;
import java.io.IOException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
public class OpValidator extends JsonDeserializer {
@Override
public PatchOperation deserialize(final JsonParser jsonParser,
final DeserializationContext deserializationContext) throws IOException {
final String operation = jsonParser.getValueAsString();
return PatchOperation.fromString(operation).orElseThrow(() ->
new IllegalArgumentException("Failed to convert PatchOperation for value " + operation));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy