All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.rrsunhome.excelsql.viewer.ViewerRegistry Maven / Gradle / Ivy

There is a newer version: 2.1.2
Show newest version
package com.github.rrsunhome.excelsql.viewer;

import org.apache.commons.collections4.CollectionUtils;

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

/**
 * @author : wangqijia
 * create at:  2021/11/4  下午7:08
 */
public class ViewerRegistry {

    protected final List viewers = new ArrayList<>();

    public ViewerRegistry() {
        addViewer(ConsoleViewer.INSTANCE);
    }

    /**
     * @param viewer 展示层
     */
    public void addViewer(Viewer viewer) {
        if (viewer != null) {
            this.viewers.add(viewer);
        }
    }

    public void addViewers(List viewers) {
        if (CollectionUtils.isNotEmpty(viewers)) {
            this.viewers.addAll(viewers);
        }
    }

    public void removeViewer(Viewer viewer) {
        if (viewer != null) {
            this.viewers.remove(viewer);
        }
    }

    public List getViewers() {
        return Collections.unmodifiableList(viewers);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy