001        package com.croftsoft.core.lang;
002    
003        /**********************************************************************
004        * A RuntimeException that is thrown when the arguments are null.
005        * 
006        * <p>
007        * The static convenience method <i>check()</i> is a useful shorthand
008        * notation for checking whether object constructor method arguments
009        * are null:
010        * <pre><code>
011        * public  Book (
012        *   final String  title,
013        *   final String  author )
014        * {
015        *   NullException.check (
016        *     this.title  = title,
017        *     this.author = author );
018        * }
019        * </code></pre>
020        * </p>
021        * 
022        * @version
023        *   $Id: NullException.java,v 1.1 2008/02/10 22:53:21 croft Exp $
024        * @since
025        *   2008-02-10
026        * @author
027        *   <a href="https://www.croftsoft.com/">David Wallace Croft</a>
028        **********************************************************************/
029    
030        public final class  NullException
031          extends RuntimeException
032        ///////////////////////////////////////////////////////////////////////
033        ///////////////////////////////////////////////////////////////////////
034        {
035           
036        private static final long  serialVersionUID = 0L;
037    
038        ///////////////////////////////////////////////////////////////////////
039        // public static methods
040        ///////////////////////////////////////////////////////////////////////
041         
042        public static void  check ( Object...  args )
043        ///////////////////////////////////////////////////////////////////////
044        {
045          for ( final Object  arg : args )
046          {
047            if ( arg == null )
048            {
049              throw new NullException ( );
050            }
051          }
052        }
053    
054        ///////////////////////////////////////////////////////////////////////
055        // public constructor methods
056        ///////////////////////////////////////////////////////////////////////
057    
058        public  NullException ( )
059        ///////////////////////////////////////////////////////////////////////
060        {
061          // empty
062        }
063    
064        public  NullException ( String  detailMessage )
065        ///////////////////////////////////////////////////////////////////////
066        {
067          super ( detailMessage );
068        }
069    
070        ///////////////////////////////////////////////////////////////////////
071        ///////////////////////////////////////////////////////////////////////
072        }