class ObjectWriterImplBigDecimal
        extends ObjectWriterPrimitiveImpl {
    static final ObjectWriterImplBigDecimal INSTANCE = new ObjectWriterImplBigDecimal(null, null);

    private final DecimalFormat format;

    final Function<Object, BigDecimal> function;

    public ObjectWriterImplBigDecimal(DecimalFormat format, Function<Object, BigDecimal> function) {
        this.format = format;
        this.function = function;
    }

    @Override
    public void writeJSONB(JSONWriter jsonWriter, Object object, Object fieldName, Type fieldType, long features) {
        BigDecimal decimal;
        if (function != null && object != null) {
            decimal = function.apply(object);
        } else {
            decimal = (BigDecimal) object;
        }
        jsonWriter.writeDecimal(decimal, features, format);
    }

    @Override
    public void write(JSONWriter jsonWriter, Object object, Object fieldName, Type fieldType, long features) {<FILL_FUNCTION_BODY>}

    public Function getFunction() {
        return function;
    }
}

        BigDecimal decimal;
        if (function != null && object != null) {
            decimal = function.apply(object);
        } else {
            decimal = (BigDecimal) object;
        }

        jsonWriter.writeDecimal(decimal, features, format);
    
<methods>public non-sealed void <init>() ,public Function#RAW getFunction() ,public void writeArrayMapping(com.alibaba.fastjson2.JSONWriter, java.lang.Object, java.lang.Object, java.lang.reflect.Type, long) ,public void writeArrayMappingJSONB(com.alibaba.fastjson2.JSONWriter, java.lang.Object, java.lang.Object, java.lang.reflect.Type, long) <variables>