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

link.thingscloud.freeswitch.esl.util.Validate Maven / Gradle / Ivy

There is a newer version: 2.1.0
Show newest version
package link.thingscloud.freeswitch.esl.util;

import java.util.Collection;
import java.util.Objects;

/**
 * 

Validate class.

* * @author zhouhailin * @version 1.0.0 */ public class Validate { /** *

isTrue.

* * @param expression a boolean. * @param message a {@link java.lang.String} object. * @param values a {@link java.lang.Object} object. */ public static void isTrue(final boolean expression, final String message, final Object... values) { if (!expression) { throw new IllegalArgumentException(String.format(message, values)); } } /** *

notEmpty.

* * @param collection a T object. * @param message a {@link java.lang.String} object. * @param values a {@link java.lang.Object} object. * @param T * @return a T object. */ public static > T notEmpty(final T collection, final String message, final Object... values) { Objects.requireNonNull(collection, () -> String.format(message, values)); if (collection.isEmpty()) { throw new IllegalArgumentException(String.format(message, values)); } return collection; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy