com.aliyun.datahub.client.impl.serializer.UpdateTopicRequestSerializer Maven / Gradle / Ivy
The newest version!
package com.aliyun.datahub.client.impl.serializer;
import com.aliyun.datahub.client.impl.request.UpdateTopicRequest;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
public class UpdateTopicRequestSerializer extends JsonSerializer {
@Override
public void serialize(UpdateTopicRequest updateTopicRequest, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
jsonGenerator.writeStartObject();
if (updateTopicRequest.getComment() != null) {
jsonGenerator.writeStringField("Comment", updateTopicRequest.getComment());
}
if (updateTopicRequest.getLifeCycle() > 0) {
jsonGenerator.writeNumberField("Lifecycle", updateTopicRequest.getLifeCycle());
}
if (updateTopicRequest.getEnableSchemaRegistry() != null) {
jsonGenerator.writeBooleanField("EnableSchemaRegistry", updateTopicRequest.getEnableSchemaRegistry());
}
jsonGenerator.writeEndObject();
}
}