org.conqat.engine.commons.util.LineRangeDeserializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of teamscale-commons Show documentation
Show all versions of teamscale-commons Show documentation
Provides common DTOs for Teamscale
The newest version!
package org.conqat.engine.commons.util;
import java.io.IOException;
import org.conqat.lib.commons.collections.CompactLines;
import org.conqat.lib.commons.string.LineRangeStringParser;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
/**
* Custom Serializer to serialize {@link CompactLines} to string separated line ranges. See
* {@link LineRangeStringParser} for more details.
*/
public class LineRangeDeserializer extends StdDeserializer {
private static final long serialVersionUID = 1L;
public LineRangeDeserializer() {
super(CompactLines.class);
}
/**
* Constructs a {@code CompactLines} instance from a string representation of line number ranges.
* Ranges in the string are denoted with '-', e.g., * "1-5,8,11-13" as e.g., used for the Testwise
* Coverage report format.
*/
@Override
public CompactLines deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
throws IOException {
return new LineRangeStringParser().parse(jsonParser.getValueAsString());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy