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

com.github.skjolber.stcsv.CsvReaderStaticInitializer Maven / Gradle / Ivy

There is a newer version: 1.0.25
Show newest version
package com.github.skjolber.stcsv;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import com.github.skjolber.stcsv.column.bi.CsvColumnValueConsumer;
import com.github.skjolber.stcsv.column.tri.CsvColumnValueTriConsumer;

public class CsvReaderStaticInitializer {

	public static class CsvStaticFields {
		private CsvColumnValueConsumer[] biConsumers;
		private CsvColumnValueTriConsumer[] triConsumers;
		
		public CsvColumnValueConsumer[] getBiConsumers() {
			return biConsumers;
		}
		
		public CsvColumnValueTriConsumer[] getTriConsumers() {
			return triConsumers;
		}

	}
	
	/**
	 * {@linkplain ConcurrentHashMap} retrievals reflect the results of the most recently 
	 * completed update operations holding upon their onset, so the classloader will
	 * always be able to retrieve stored values.
	 */
	
	protected static final Map values = new ConcurrentHashMap<>();
	
	public static CsvStaticFields remove(String className) {
		return values.remove(className);
	}
	
	public static void add(String className, CsvColumnValueConsumer[] biConsumers, CsvColumnValueTriConsumer[] triConsumers) {
		CsvStaticFields wrapper = new CsvStaticFields();
		wrapper.biConsumers = biConsumers;
		wrapper.triConsumers = triConsumers;
		
		values.put(className, wrapper);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy