package com.kfzs.duanduan.bean;

/**
 * @ Created by Dlg
 * @ <p>TiTle:  RecyleObj</p>
 * @ <p>Description:</p>
 * @ date:  2017/6/15 13:19
 * @ QQ:    315096953
 */

public class RecyleObj {

    private RecyleType recyleType;

    private int index;

    private Object dataObj;

    private Boolean isLoaded = false;//是否已经加载过了，用于性能优化

    public Boolean getLoaded() {
        return isLoaded == null ? false : isLoaded;
    }

    public void setLoaded(Boolean loaded) {
        isLoaded = loaded;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public Object getDataObj() {
        return dataObj;
    }

    public void setDataObj(Object dataObj) {
        this.dataObj = dataObj;
    }

    public RecyleType getRecyleType() {
        return recyleType;
    }

    public void setRecyleType(RecyleType recyleType) {
        this.recyleType = recyleType;
    }


    /**
     * 生成指定RecyleView的类
     *
     * @param recyleType
     * @param dataObj
     * @return
     */
    public static RecyleObj make(RecyleType recyleType, Object dataObj) {
        RecyleObj recyleObj = new RecyleObj();
        recyleObj.setRecyleType(recyleType);
        recyleObj.setDataObj(dataObj);
        return recyleObj;
    }

    public static RecyleObj make(RecyleType recyleType, Object dataObj, int position) {
        RecyleObj recyleObj = new RecyleObj();
        recyleObj.setRecyleType(recyleType);
        recyleObj.setDataObj(dataObj);
        recyleObj.setIndex(position);
        return recyleObj;
    }
}
