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

org.sfm.csv.impl.ParsingContextFactory Maven / Gradle / Ivy

package org.sfm.csv.impl;


import org.sfm.map.ParsingContextProvider;

public class ParsingContextFactory {

    private static final ParsingContext NULL_PARSING_CONTEXT = new ParsingContext(null);
    private final ParsingContextProvider[] providers;
	
	public ParsingContextFactory(ParsingContextProvider[] providers) {
	    this.providers = providers;
	}


	public ParsingContext newContext() {
        if (providers != null) {
            Object[] context = new Object[providers.length];

            for (int i = 0; i < providers.length; i++) {
                ParsingContextProvider provider = providers[i];
                if (provider != null) {
                    context[i] = provider.newContext();
                }
            }
            return new ParsingContext(context);
        } else {
            return NULL_PARSING_CONTEXT;
        }
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy