com.instaclustr.jackson.JMXServiceURLSerializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons Show documentation
Show all versions of commons Show documentation
Common classes and utilities integrated with various projects
package com.instaclustr.jackson;
import javax.management.remote.JMXServiceURL;
import java.io.IOException;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
public class JMXServiceURLSerializer extends StdSerializer {
public JMXServiceURLSerializer() {
this(null);
}
public JMXServiceURLSerializer(Class t) {
super(t);
}
@Override
public void serialize(JMXServiceURL value, JsonGenerator gen, SerializerProvider provider) throws IOException {
if (value != null) {
gen.writeString(value.toString());
}
}
}