io.sphere.sdk.json.LocaleSerializer Maven / Gradle / Ivy
package io.sphere.sdk.json;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdScalarSerializer;
import java.io.IOException;
import java.util.Locale;
final class LocaleSerializer extends StdScalarSerializer {
static final long serialVersionUID = 0L;
public LocaleSerializer() {
super(Locale.class);
}
@Override
public void serialize(final Locale locale, final JsonGenerator jsonGenerator, final SerializerProvider provider) throws IOException {
jsonGenerator.writeString(locale.toLanguageTag());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy