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

com.thoughtworks.gauge.datastore.DataStoreFactory Maven / Gradle / Ivy

/*----------------------------------------------------------------
 *  Copyright (c) ThoughtWorks, Inc.
 *  Licensed under the Apache License, Version 2.0
 *  See LICENSE.txt in the project root for license information.
 *----------------------------------------------------------------*/
package com.thoughtworks.gauge.datastore;

public class DataStoreFactory {
    private static ThreadLocal suiteDataStore = new InheritableThreadLocal() {
        @Override
        protected DataStore initialValue() {
            return new DataStore();
        }
    };
    private static ThreadLocal specDataStore = new InheritableThreadLocal() {
        @Override
        protected DataStore initialValue() {
            return new DataStore();
        }
    };
    private static ThreadLocal scenarioDataStore = new InheritableThreadLocal() {
        @Override
        protected DataStore initialValue() {
            return new DataStore();
        }
    };


    /**
     * @return The current instance of the SuiteDataStore
     */
    public static DataStore getSuiteDataStore() {
        return suiteDataStore.get();
    }

    /**
     * @return The current instance of the SpecDataStore
     */
    public static DataStore getSpecDataStore() {
        return specDataStore.get();
    }

    /**
     * @return The current instance of the ScenarioDataStore
     */
    public static DataStore getScenarioDataStore() {
        return scenarioDataStore.get();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy