View Javadoc

1   /*
2    * Copyright (C) 1998, 2003 Gargoyle Software. All rights reserved.
3    * 
4    * This file is part of GSBase. For details on use and redistribution please
5    * refer to the license.html file included with these sources.
6    */
7   package com.diasparsoftware.gsbase;
8   
9   import com.gargoylesoftware.base.util.DetailedNullPointerException;
10  
11  /***
12   * A utility for runtime assertions.
13   * 
14   * @version $Revision: 1.1 $
15   * @author <a href="mailto:jbr@diasparsoftware.com">J. B. Rainsberger </a>
16   */
17  public class Assert {
18      // TODO Replace me with the Assert class in HTMLUnit.
19  
20      /***
21       * Throws a runtime exception if the specified value is null.
22       * 
23       * @param argumentName
24       *            The name of the argument you are checking
25       * @param argumentValue
26       *            The value of the argument you are checking
27       * @throws DetailedNullPointerException
28       *             Thrown if <code>argumentValue</code> is null
29       */
30      public static final void notNull(final String argumentName,
31          final Object argumentValue) {
32  
33          if (argumentValue == null) { throw new DetailedNullPointerException(
34              argumentName); }
35      }
36  }