/*
 * Image/J Plugins
 * Copyright (C) 2002-2009 Jarek Sacha
 * Author's email: jsacha at users dot sourceforge dot net
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Latest release available at http://sourceforge.net/projects/ij-plugins/
 */

package net.sf.ij_plugins.util;

/**
 * @author Jarek Sacha
 * @since Oct 22, 2009 7:34:52 PM
 */
public final class Validate {

    private Validate() {
    }

    /**
     * Checks if the object is not {@code null}. If it is {@code null} throws {@link IllegalArgumentException}.
     *
     * @param object argument to be validated.
     * @param name   argument name, used in exception message.
     * @throws IllegalArgumentException if {@code object} is null.
     */
    public static void argumentNotNull(final Object object, final String name) throws IllegalArgumentException {
        if (object == null) {
            throw new IllegalArgumentException(
                    name != null
                            ? "Argument '" + name + "' cannot be null."
                            : "Argument cannot be null.");
        }
    }
}

@@ -41,18 +41,18 @@
  2002-20
+1
 0
-9
  Jarek S
@@ -1125,24 +1125,26 @@
 %7B%0D%0A    %7D%0D%0A%0D%0A
+%0D%0A
     /**%0D%0A   
@@ -1822,18 +1822,972 @@
      %7D%0D%0A
-
     %7D%0D%0A
+%0D%0A%0D%0A    /**%0D%0A     * %3Cp%3EValidate that the argument condition is %3Ccode%3Etrue%3C/code%3E; otherwise%0D%0A     * throwing an exception with the specified message. This method is useful when%0D%0A     * validating according to an arbitrary boolean expression, such as validating a%0D%0A     * primitive number or using your own custom validation expression.%3C/p%3E%0D%0A     * %3Cp/%3E%0D%0A     * %3Cpre%3E%0D%0A     * Validate.isTrue( (i %3E 0), %22The value must be greater than zero%22);%0D%0A     * Validate.isTrue( myObject.isOk(), %22The object is not OK%22);%0D%0A     * %3C/pre%3E%0D%0A     *%0D%0A     * @param expression the boolean expression to check%0D%0A     * @param message    the exception message if invalid%0D%0A     * @throws IllegalArgumentException if expression is %3Ccode%3Efalse%3C/code%3E%0D%0A     */%0D%0A    public static void isTrue(final boolean expression, final String message) throws IllegalArgumentException %7B%0D%0A        if (!expression) %7B%0D%0A            throw new IllegalArgumentException(message);%0D%0A        %7D%0D%0A    %7D%0D%0A%0D%0A
 %7D%0D%0A

Add isTrue().