package com.test.common.utils.sql;

import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;

import java.io.IOException;

/**
 * @author liangdaliang
 * @Description：
 * @date 2025-03-07 13:32
 */
public class TinyIntTypeAdapter extends TypeAdapter<Byte> {
    @Override
    public void write(JsonWriter out, Byte value) throws IOException {
        if (value == null) {
            out.nullValue();
        } else {
            out.value(value.intValue());
        }
    }

    @Override
    public Byte read(JsonReader in) throws IOException {
        throw new UnsupportedOperationException("Unreadable");
    }
}
