org.testifyproject.fasterxml.jackson.databind.ext.NioPathSerializer Maven / Gradle / Ivy
The newest version!
package org.testifyproject.testifyproject.fasterxml.jackson.databind.ext;
import java.io.IOException;
import java.nio.file.Path;
import org.testifyproject.testifyproject.fasterxml.jackson.core.JsonGenerator;
import org.testifyproject.testifyproject.fasterxml.jackson.databind.SerializerProvider;
import org.testifyproject.testifyproject.fasterxml.jackson.databind.ser.std.StdScalarSerializer;
/**
* @since 2.8
*/
public class NioPathSerializer extends StdScalarSerializer
{
private static final long serialVersionUID = 1;
public NioPathSerializer() { super(Path.class); }
@Override
public void serialize(Path value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
// write the Path as a URI, always.
gen.writeString(value.toUri().toString());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy