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

org.dataloader.impl.Assertions Maven / Gradle / Ivy

There is a newer version: 2022-09-12T23-25-35-08559ba
Show newest version
package org.dataloader.impl;

import org.dataloader.annotations.Internal;

import java.util.function.Supplier;

@Internal
public class Assertions {

    public static void assertState(boolean state, Supplier message) {
        if (!state) {
            throw new DataLoaderAssertionException(message.get());
        }
    }

    public static  T nonNull(T t) {
        return nonNull(t, () -> "nonNull object required");
    }

    public static  T nonNull(T t, Supplier message) {
        if (t == null) {
            throw new NullPointerException(message.get());
        }
        return t;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy