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

com.sap.it.commons.lang.Checks Maven / Gradle / Ivy

The newest version!
package com.sap.it.commons.lang;

public class Checks {
    private Checks() {
    }

    public static  T nonNull(T obj, String message) throws NullPointerException {
        if (obj == null) {
            throw new NullPointerException(message); // NOPMD
        }
        return obj;
    }

    public static  T nonNullArgument(T obj, String message) throws IllegalArgumentException {
        if (obj == null) {
            throw new IllegalArgumentException(message); // NOPMD
        }
        return obj;
    }

    public static String nonEmpty(String string, String message) throws IllegalArgumentException {
        if (string == null || string.isEmpty()) {
            throw new IllegalArgumentException(message);
        }
        return string;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy