/**
 * Copyright (C) 2013 Sébastien Lesaint (http://www.javatronic.fr/)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package fr.javatronic.damapping.util;

/**
 * Preconditions - Partial clone of Guava's Preconditions class
 *
 * @author Sébastien Lesaint
 */
public final class Preconditions {
  private Preconditions() {
    // prevents instantiation
  }

  public static <T> T checkNotNull(T obj) {
    return checkNotNull(obj, "object can not be null");
  }

  public static <T> void checkArgument(boolean test) {
    if (!test) {
      throw new IllegalArgumentException("Argument is not valid");
    }
  }

  public static <T> T checkNotNull(T obj, String message) {
    if (obj == null) {
      throw new NullPointerException(message);
    }
    return obj;
  }
}

@@ -670,16 +670,84 @@
 .util;%0A%0A
+import javax.annotation.Nonnull;%0Aimport javax.annotation.Nullable;%0A%0A
 /**%0A * P
@@ -881,70 +881,483 @@
 s %7B%0A
-  private Preconditions() %7B%0A    // prevents instantiation%0A  %7D%0A
+%0A  private static final String NPE_DEFAULT_MSG = %22object can not be null%22;%0A  private static final String IAE_DEFAULT_MSG = %22Argument is not valid%22;%0A%0A  private Preconditions() %7B%0A    // prevents instantiation%0A  %7D%0A%0A  /**%0A   * Throws a NullPointerException with a generic message if the specified object is %7B@code null%7D, otherwise%0A   * returns it.%0A   *%0A   * @param obj an object of any type or %7B@code null%7D%0A   * @param %3CT%3E any type%0A   *%0A   * @return the argument%0A   */%0A  @Nonnull
 %0A  p
@@ -1384,24 +1384,34 @@
 heckNotNull(
+@Nullable 
 T obj) %7B%0A   
@@ -1440,189 +1440,1330 @@
 bj, 
-%22object can not be null%22);%0A  %7D%0A%0A  public static %3CT%3E void checkArgument(boolean test) %7B%0A    if (!test) %7B%0A      throw new IllegalArgumentException(%22Argument is not valid%22);%0A    %7D%0A  %7D%0A
+NPE_DEFAULT_MSG);%0A  %7D%0A%0A  /**%0A   * Throws a NullPointerException with the specified message if the specified object is %7B@code null%7D, otherwise%0A   * returns it.%0A   * %3Cp%3E%0A   * A default message will be used if the specified message is %7B@code null%7D or empty.%0A   * %3C/p%3E%0A   *%0A   * @param obj     an object of any type or %7B@code null%7D%0A   * @param message a %7B@link String%7D or %7B@code null%7D%0A   * @param %3CT%3E     any type%0A   *%0A   * @return the argument%0A   */%0A  @Nonnull%0A  public static %3CT%3E T checkNotNull(@Nullable T obj, @Nullable String message) %7B%0A    if (obj == null) %7B%0A      throw new NullPointerException(message == null %7C%7C message.isEmpty() ? NPE_DEFAULT_MSG : message);%0A    %7D%0A    return obj;%0A  %7D%0A%0A  /**%0A   * Throws a %7B@link IllegalArgumentException%7D with a generic message if the specified boolean value is false.%0A   *%0A   * @param test a boolean value%0A   */%0A  public static void checkArgument(boolean test) %7B%0A    if (!test) %7B%0A      throw new IllegalArgumentException(IAE_DEFAULT_MSG);%0A    %7D%0A  %7D%0A%0A  /**%0A   * Throws a %7B@link IllegalArgumentException%7D with the specified message if the specified boolean%0A   * value is false.%0A   * %3Cp%3E%0A   * A default message will be used if the specified message is %7B@code null%7D or empty.%0A   * %3C/p%3E%0A   *%0A   * @param test    a boolean value%0A   * @param message a %7B@link String%7D or %7B@code null%7D%0A   */
 %0A  p
@@ -2779,33 +2779,50 @@
 tic 
-%3CT%3E T
+void
  check
-NotNull(T obj,
+Argument(boolean test, @Nullable
  Str
@@ -2840,35 +2840,29 @@
 ) %7B%0A    if (
-obj == null
+!test
 ) %7B%0A      th
@@ -2865,35 +2865,39 @@
   throw new 
-NullPointer
+IllegalArgument
 Exception(me
@@ -2905,32 +2905,73 @@
 sage
-);%0A    %7D%0A    return obj;
+ == null %7C%7C message.isEmpty() ? IAE_DEFAULT_MSG : message);%0A    %7D
 %0A  %7D

add Preconditions.checkArgumen(boolean, String)