package com.changhu.support.fastjson2.serializer;

import cn.hutool.extra.spring.SpringUtil;
import com.alibaba.fastjson2.JSONWriter;
import com.alibaba.fastjson2.writer.ObjectWriter;

import java.lang.reflect.Type;

/**
 * @author 20252
 * @createTime 2024/10/10 下午3:19
 * @desc MinioPrefixSerializer...
 */
public class MinioPrefixSerializer implements ObjectWriter<String> {

    private final String minioPrefix = SpringUtil.getProperty("minio.url");

    public static final MinioPrefixSerializer instance = new MinioPrefixSerializer();

    private MinioPrefixSerializer() {
    }

    @Override
    public void write(JSONWriter jsonWriter, Object object, Object fieldName, Type fieldType, long features) {
        jsonWriter.writeString(minioPrefix + object);
    }
}
