hygieia.transformer.QualityVisiteeDeserializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core Show documentation
Show all versions of core Show documentation
Core package shared by API layer and Microservices
package hygieia.transformer;
import com.capitalone.dashboard.model.quality.CucumberJsonReport;
import com.capitalone.dashboard.model.quality.MochaJsSpecReport;
import com.capitalone.dashboard.model.quality.QualityVisitee;
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;
/**
* Created by stevegal on 2019-03-25.
*/
public class QualityVisiteeDeserializer extends JsonDeserializer {
@Override
public QualityVisitee deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {
// this is a simple test, but we've only got 2 to distinguish between here, so this test will suffice
if (JsonToken.START_ARRAY == jsonParser.currentToken()) {
return jsonParser.getCodec().readValue(jsonParser, CucumberJsonReport.class);
}
return jsonParser.getCodec().readValue(jsonParser, MochaJsSpecReport.class);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy