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

com.github.cloudyrock.dimmer.Util Maven / Gradle / Ivy

Go to download

Lightweight library to manage feature toggling. Unlike others Dimmer doesn't work in switch mode, black or white, It provides a flexible way to respond to disabled features by adding customizable behaviours and pre-configured responses.

There is a newer version: 2.2.2
Show newest version
package com.github.cloudyrock.dimmer;

import java.lang.reflect.Array;
import java.util.Collection;
import java.util.Objects;

/**
 * @author Antonio Perez Dieppa
 * @since 11/06/2018
 */
final class Util {
    static void checkArgumentNullEmpty(Object arg, String argName) {
        if (Objects.isNull(arg)) {
            throw new IllegalArgumentException(
                    String.format("arg %s cannot be null", argName));
        }

        if ((arg.getClass().isArray() && Array.getLength(arg) <= 0)
                || (arg instanceof Collection && ((Collection) arg).isEmpty())) {
            throw new IllegalArgumentException(
                    String.format("arg %s cannot be empty", argName));
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy