All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.unblu.webapi.model.v3.ExpandableFieldSerializer Maven / Gradle / Ivy

There is a newer version: 7.51.0
Show newest version
package com.unblu.webapi.model.v3;

import java.io.IOException;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

public class ExpandableFieldSerializer extends JsonSerializer> {

	@Override
	public void serialize(final ExpandableField value, final JsonGenerator gen, final SerializerProvider serializers) throws IOException {
		if (value == null) {
			gen.writeNull();
		} else if (value.isExpanded()) {
			gen.writeObject(value.getExpanded());
		} else {
			gen.writeString(value.getId());
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy