package com.brilliance.isc.common.builder;

import com.brilliance.isc.common.transaction.vo.BaseTransactionVo;

/**
 * 用于对应原系统的default rule和ini rule
 */
public abstract class AbstractTransBoBuilder<T extends BaseTransactionVo> {
    private ThreadLocal<String> modeThreadLocal = new ThreadLocal<>();

    public final String MODE_SAVE = "SAVE";

    public final String MODE_INIT = "INIT";

    public abstract void build(T transBo);


    public String getMode(){
        return modeThreadLocal.get();
    }


    public void setSaveMode(){
        modeThreadLocal.set(MODE_SAVE);
    }

    public void setInitMode(){
        modeThreadLocal.set(MODE_INIT);
    }

    public boolean isInitMode(){
        return MODE_INIT.equals(this.getMode());
    }

    public boolean isSaveMode(){
        return MODE_SAVE.equals(this.getMode());
    }

}

