io.qameta.allure.model.StatusDeserializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of allure2-model-jackson Show documentation
Show all versions of allure2-model-jackson Show documentation
Module contains pre-configured Jackson mapper for Allure2 model pojo
The newest version!
package io.qameta.allure.model;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import java.io.IOException;
import java.util.stream.Stream;
/**
* @author charlie (Dmitry Baev).
*/
public class StatusDeserializer extends StdDeserializer {
protected StatusDeserializer() {
super(Status.class);
}
@Override
public Status deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
String value = p.readValueAs(String.class);
return Stream.of(Status.values())
.filter(status -> status.value().equalsIgnoreCase(value))
.findAny()
.orElse(null);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy