com.geotab.model.serialization.FaultResetModeDeserializer Maven / Gradle / Ivy
package com.geotab.model.serialization;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.geotab.model.enumeration.FaultResetMode;
import java.io.IOException;
/**
* Custom {@link FaultResetMode} deserializer, which returns {@link FaultResetMode#NONE} as default
* if the json value is not recognized.
*/
public class FaultResetModeDeserializer extends JsonDeserializer {
@Override
public FaultResetMode deserialize(JsonParser jsonParser,
DeserializationContext deserializationContext) throws IOException {
return FaultResetMode.findOrDefault(jsonParser.getValueAsString());
}
}