package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.jx;

import cn.estsh.i3plus.ext.mes.pcn.api.busi.jx.ISxAttributeCompareFilterService;

import java.util.ArrayList;
import java.util.List;

public class SxAttributeCompareFilterChain<T> implements ISxAttributeCompareFilterService<T> {

    private List<ISxAttributeCompareFilterService> filterList = new ArrayList<>();

    public SxAttributeCompareFilterChain add(ISxAttributeCompareFilterService filter) {
        filterList.add(filter);
        return this;
    }

    @Override
    public Boolean doFilter(T t1, T t2, Class c1, Class c2) {
        for(ISxAttributeCompareFilterService filter : filterList) {
            if(!filter.doFilter(t1, t2, c1, c2)) return false;
        }
        return true;
    }

}


