
eu.interedition.text.json.TextRangeSerializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of text-core Show documentation
Show all versions of text-core Show documentation
Stand-off Markup/Annotation Text Model
The newest version!
package eu.interedition.text.json;
import eu.interedition.text.TextRange;
import java.io.IOException;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;
/**
* @author Gregor Middell
*/
public class TextRangeSerializer extends JsonSerializer {
@Override
public Class handledType() {
return TextRange.class;
}
@Override
public void serialize(TextRange value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
jgen.writeStartArray();
jgen.writeNumber(value.getStart());
jgen.writeNumber(value.getEnd());
jgen.writeEndArray();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy