// Path: src/main/java/org/dataloader/impl/Assertions.java
// @Internal
// public class Assertions {
// 
//     public static void assertState(boolean state, Supplier<String> message) {
//         if (!state) {
//             throw new DataLoaderAssertionException(message.get());
//         }
//     }
// 
//     public static <T> T nonNull(T t) {
//         return nonNull(t, () -> "nonNull object required");
//     }
// 
//     public static <T> T nonNull(T t, Supplier<String> message) {
//         if (t == null) {
//             throw new NullPointerException(message.get());
//         }
//         return t;
//     }
// 
// }
// 
// Path: src/main/java/org/dataloader/stats/SimpleStatisticsCollector.java
// public class SimpleStatisticsCollector implements StatisticsCollector {
//     private final AtomicLong loadCount = new AtomicLong();
//     private final AtomicLong batchInvokeCount = new AtomicLong();
//     private final AtomicLong batchLoadCount = new AtomicLong();
//     private final AtomicLong cacheHitCount = new AtomicLong();
//     private final AtomicLong batchLoadExceptionCount = new AtomicLong();
//     private final AtomicLong loadErrorCount = new AtomicLong();
// 
//     @Override
//     public long incrementLoadCount() {
//         return loadCount.incrementAndGet();
//     }
// 
// 
//     @Override
//     public long incrementBatchLoadCountBy(long delta) {
//         batchInvokeCount.incrementAndGet();
//         return batchLoadCount.addAndGet(delta);
//     }
// 
//     @Override
//     public long incrementCacheHitCount() {
//         return cacheHitCount.incrementAndGet();
//     }
// 
//     @Override
//     public long incrementLoadErrorCount() {
//         return loadErrorCount.incrementAndGet();
//     }
// 
//     @Override
//     public long incrementBatchLoadExceptionCount() {
//         return batchLoadExceptionCount.incrementAndGet();
//     }
// 
//     @Override
//     public Statistics getStatistics() {
//         return new Statistics(loadCount.get(), loadErrorCount.get(), batchInvokeCount.get(), batchLoadCount.get(), batchLoadExceptionCount.get(), cacheHitCount.get());
//     }
// 
//     @Override
//     public String toString() {
//         return getStatistics().toString();
//     }
// }
// 
// Path: src/main/java/org/dataloader/stats/StatisticsCollector.java
// @PublicSpi
// public interface StatisticsCollector {
// 
//     /**
//      * Called to increment the number of loads
//      *
//      * @return the current value after increment
//      */
//     long incrementLoadCount();
// 
//     /**
//      * Called to increment the number of loads that resulted in an object deemed in error
//      *
//      * @return the current value after increment
//      */
//     long incrementLoadErrorCount();
// 
//     /**
//      * Called to increment the number of batch loads
//      *
//      * @param delta how much to add to the count
//      *
//      * @return the current value after increment
//      */
//     long incrementBatchLoadCountBy(long delta);
// 
//     /**
//      * Called to increment the number of batch loads exceptions
//      *
//      * @return the current value after increment
//      */
//     long incrementBatchLoadExceptionCount();
// 
//     /**
//      * Called to increment the number of cache hits
//      *
//      * @return the current value after increment
//      */
//     long incrementCacheHitCount();
// 
//     /**
//      * @return the statistics that have been gathered up to this point in time
//      */
//     Statistics getStatistics();
// }
// 
// Path: src/main/java/org/dataloader/impl/Assertions.java
// public static <T> T nonNull(T t) {
//     return nonNull(t, () -> "nonNull object required");
// }


import org.dataloader.annotations.PublicApi;
import org.dataloader.impl.Assertions;
import org.dataloader.stats.SimpleStatisticsCollector;
import org.dataloader.stats.StatisticsCollector;
import java.util.Optional;
import java.util.function.Supplier;
import static org.dataloader.impl.Assertions.nonNull;
/*
 * Copyright (c) 2016 The original author or authors
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * and Apache License v2.0 which accompanies this distribution.
 *
 *      The Eclipse Public License is available at
 *      http://www.eclipse.org/legal/epl-v10.html
 *
 *      The Apache License v2.0 is available at
 *      http://www.opensource.org/licenses/apache2.0.php
 *
 * You may elect to redistribute this code under either of these licenses.
 */

package org.dataloader;




/**
 * Configuration options for {@link DataLoader} instances.
 *
 * @author <a href="https://github.com/aschrijver/">Arnold Schrijver</a>
 */
@PublicApi
public class DataLoaderOptions {

    private static final BatchLoaderContextProvider NULL_PROVIDER = () -> null;

    private boolean batchingEnabled;
    private boolean cachingEnabled;
    private boolean cachingExceptionsEnabled;
    private CacheKey<?> cacheKeyFunction;
    private CacheMap<?, ?> cacheMap;
    private ValueCache<?, ?> valueCache;
    private int maxBatchSize;
    private Supplier<StatisticsCollector> statisticsCollector;
    private BatchLoaderContextProvider environmentProvider;
    private ValueCacheOptions valueCacheOptions;

    /**
     * Creates a new data loader options with default settings.
     */
    public DataLoaderOptions() {
        batchingEnabled = true;
        cachingEnabled = true;
        cachingExceptionsEnabled = true;
        maxBatchSize = -1;
// Path: src/main/java/org/dataloader/impl/Assertions.java
// @Internal
// public class Assertions {
// 
//     public static void assertState(boolean state, Supplier<String> message) {
//         if (!state) {
//             throw new DataLoaderAssertionException(message.get());
//         }
//     }
// 
//     public static <T> T nonNull(T t) {
//         return nonNull(t, () -> "nonNull object required");
//     }
// 
//     public static <T> T nonNull(T t, Supplier<String> message) {
//         if (t == null) {
//             throw new NullPointerException(message.get());
//         }
//         return t;
//     }
// 
// }
// 
// Path: src/main/java/org/dataloader/stats/SimpleStatisticsCollector.java
// public class SimpleStatisticsCollector implements StatisticsCollector {
//     private final AtomicLong loadCount = new AtomicLong();
//     private final AtomicLong batchInvokeCount = new AtomicLong();
//     private final AtomicLong batchLoadCount = new AtomicLong();
//     private final AtomicLong cacheHitCount = new AtomicLong();
//     private final AtomicLong batchLoadExceptionCount = new AtomicLong();
//     private final AtomicLong loadErrorCount = new AtomicLong();
// 
//     @Override
//     public long incrementLoadCount() {
//         return loadCount.incrementAndGet();
//     }
// 
// 
//     @Override
//     public long incrementBatchLoadCountBy(long delta) {
//         batchInvokeCount.incrementAndGet();
//         return batchLoadCount.addAndGet(delta);
//     }
// 
//     @Override
//     public long incrementCacheHitCount() {
//         return cacheHitCount.incrementAndGet();
//     }
// 
//     @Override
//     public long incrementLoadErrorCount() {
//         return loadErrorCount.incrementAndGet();
//     }
// 
//     @Override
//     public long incrementBatchLoadExceptionCount() {
//         return batchLoadExceptionCount.incrementAndGet();
//     }
// 
//     @Override
//     public Statistics getStatistics() {
//         return new Statistics(loadCount.get(), loadErrorCount.get(), batchInvokeCount.get(), batchLoadCount.get(), batchLoadExceptionCount.get(), cacheHitCount.get());
//     }
// 
//     @Override
//     public String toString() {
//         return getStatistics().toString();
//     }
// }
// 
// Path: src/main/java/org/dataloader/stats/StatisticsCollector.java
// @PublicSpi
// public interface StatisticsCollector {
// 
//     /**
//      * Called to increment the number of loads
//      *
//      * @return the current value after increment
//      */
//     long incrementLoadCount();
// 
//     /**
//      * Called to increment the number of loads that resulted in an object deemed in error
//      *
//      * @return the current value after increment
//      */
//     long incrementLoadErrorCount();
// 
//     /**
//      * Called to increment the number of batch loads
//      *
//      * @param delta how much to add to the count
//      *
//      * @return the current value after increment
//      */
//     long incrementBatchLoadCountBy(long delta);
// 
//     /**
//      * Called to increment the number of batch loads exceptions
//      *
//      * @return the current value after increment
//      */
//     long incrementBatchLoadExceptionCount();
// 
//     /**
//      * Called to increment the number of cache hits
//      *
//      * @return the current value after increment
//      */
//     long incrementCacheHitCount();
// 
//     /**
//      * @return the statistics that have been gathered up to this point in time
//      */
//     Statistics getStatistics();
// }
// 
// Path: src/main/java/org/dataloader/impl/Assertions.java
// public static <T> T nonNull(T t) {
//     return nonNull(t, () -> "nonNull object required");
// }


// Path: src/main/java/org/dataloader/DataLoaderOptions.java
import org.dataloader.annotations.PublicApi;
import org.dataloader.impl.Assertions;
import org.dataloader.stats.SimpleStatisticsCollector;
import org.dataloader.stats.StatisticsCollector;
import java.util.Optional;
import java.util.function.Supplier;
import static org.dataloader.impl.Assertions.nonNull;

/*
 * Copyright (c) 2016 The original author or authors
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * and Apache License v2.0 which accompanies this distribution.
 *
 *      The Eclipse Public License is available at
 *      http://www.eclipse.org/legal/epl-v10.html
 *
 *      The Apache License v2.0 is available at
 *      http://www.opensource.org/licenses/apache2.0.php
 *
 * You may elect to redistribute this code under either of these licenses.
 */

package org.dataloader;




/**
 * Configuration options for {@link DataLoader} instances.
 *
 * @author <a href="https://github.com/aschrijver/">Arnold Schrijver</a>
 */
@PublicApi
public class DataLoaderOptions {

    private static final BatchLoaderContextProvider NULL_PROVIDER = () -> null;

    private boolean batchingEnabled;
    private boolean cachingEnabled;
    private boolean cachingExceptionsEnabled;
    private CacheKey<?> cacheKeyFunction;
    private CacheMap<?, ?> cacheMap;
    private ValueCache<?, ?> valueCache;
    private int maxBatchSize;
    private Supplier<StatisticsCollector> statisticsCollector;
    private BatchLoaderContextProvider environmentProvider;
    private ValueCacheOptions valueCacheOptions;

    /**
     * Creates a new data loader options with default settings.
     */
    public DataLoaderOptions() {
        batchingEnabled = true;
        cachingEnabled = true;
        cachingExceptionsEnabled = true;
        maxBatchSize = -1;
        statisticsCollector = SimpleStatisticsCollector::new;