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

com.artfii.fluentsql.core.Assert Maven / Gradle / Ivy

There is a newer version: 0.0.17.10
Show newest version
package com.artfii.fluentsql.core;

/**
 * Func : trueThenThrow
 *
 * @author: leeton on 2019/6/21.
 */
public class Assert {
    public static void isNull(Object val, String throwMsg) {
        trueThenThrow(null == val, throwMsg);
    }

    public static void isBlank(Object val, String throwMsg) {
        trueThenThrow(null == val || String.valueOf(val).trim().length() == 0, throwMsg);
    }

    public static void isNotFound(Object val, String throwMsg) {
        trueThenThrow(null == val || val.equals("false") || val.equals(-1), throwMsg);
    }

    public static void isFalse(boolean test, String throwMsg) {
        trueThenThrow(false==test, throwMsg);
    }

    public static void isTrue(boolean test, String throwMsg) {
        trueThenThrow(test, throwMsg);
    }

    public static void trueThenThrow(boolean test, String throwMsg) {
        if (test) {
            throw new RuntimeException(throwMsg);
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy