Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/* Copyright (c) 2010 TOPP - www.openplans.org.  All rights reserved.
 * This code is licensed under the GPL 2.0 license, availible at the root
 * application directory.
 */

public class Main {
    /**
     * Ensures that the provided argument is not <code>null</code>.
     * <p>
     * If it <code>null</code> it must throw a {@link NullPointerException}.
     * 
     * @param argument argument to check for <code>null</code>.
     */
    protected static void ensureNotNull(final Object argument) {
        ensureNotNull(argument, "Argument cannot be null");
    }

    /**
     * Ensures that the provided argument is not <code>null</code>.
     * <p>
     * If it <code>null</code> it must throw a {@link NullPointerException}.
     * 
     * @param argument argument to check for <code>null</code>.
     * @param message  leading message to print out in case the test fails.
     */
    protected static void ensureNotNull(final Object argument, final String message) {
        if (message == null)
            throw new NullPointerException("Message cannot be null");
        if (argument == null)
            throw new NullPointerException(message + " cannot be null");
    }
}