package com.bohuikeji.frame.module.admin.entity.configure;

import com.bohuikeji.frame.module.admin.annotation.TableNewField;
import com.bohuikeji.frame.module.admin.enums.ColumnWayEnum;

/**
 * 新增配置
 * @author 10552
 */
public class NewAn extends BaseInputAn{
    /**
     * 默认值生成方式
     */
    ColumnWayEnum way=ColumnWayEnum.DEFAULT;

    public static NewAn getInstance(TableNewField newField){
        if(newField==null){return null;}
        if (!newField.add()){return null;}
        NewAn newAn=new NewAn();
        newAn.setWay(newAn.getWay());
        newAn.setShow(newField.show());
        newAn.setDisable(newField.edit());
        newAn.setRegEx(newField.limit());
        newAn.setBlock(newField.block().getName());
        newAn.setOption(newField.options());
        return newAn;
    }

    public ColumnWayEnum getWay() {
        return way;
    }

    public NewAn setWay(ColumnWayEnum way) {
        this.way = way;
        return this;
    }
}
