AnnoUtils.java

/*
 * SPDX-FileCopyrightText: 2026 kaumei.io
 * SPDX-License-Identifier: Apache-2.0
 */
package io.kaumei.jdbc.anno.utils;

import org.jspecify.annotations.Nullable;

import java.util.function.Supplier;

public final class AnnoUtils {

    private AnnoUtils() { // JaCoCo:no
    }

    public static <T> T requireState(@Nullable T value, Supplier<String> messageSupplier) {
        if (value == null) {
            throw new IllegalStateException(messageSupplier.get());
        }
        return value;
    }

    public static <T> T requireState(@Nullable T value, String message) {
        if (value == null) {
            throw new IllegalStateException(message);
        }
        return value;
    }
}