com.codingapi.springboot.framework.serializable.EnumSerializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of springboot-starter Show documentation
Show all versions of springboot-starter Show documentation
springboot-starter project for Spring Boot
package com.codingapi.springboot.framework.serializable;
import com.codingapi.springboot.framework.em.IEnum;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
public class EnumSerializer extends JsonSerializer {
@Override
public void serialize(IEnum iEnum, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
jsonGenerator.writeNumber(iEnum.getCode());
}
}