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

tech.tablesaw.io.WriterRegistry Maven / Gradle / Ivy

There is a newer version: 0.43.1
Show newest version
package tech.tablesaw.io;

import java.util.HashMap;
import java.util.Map;

public class WriterRegistry {

    private final Map> optionTypesRegistry = new HashMap<>();

    private final Map> extensionsRegistry = new HashMap<>();

    public void registerOptions(Class optionsType, DataWriter writer) {
	optionTypesRegistry.put(optionsType.getCanonicalName(), writer);
    }

    public void registerExtension(String extension, DataWriter writer) {
	extensionsRegistry.put(extension, writer);
    }

    @SuppressWarnings("unchecked")
    public  DataWriter getWriterForOptions(T options) {
	return (DataWriter) optionTypesRegistry.get(options.getClass().getCanonicalName());
    }

    public DataWriter getWriterForExtension(String extension) {
	return extensionsRegistry.get(extension);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy