You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2006/07/28 18:31:29 UTC

svn commit: r426600 - /lenya/trunk/src/java/org/apache/lenya/util/Assert.java

Author: andreas
Date: Fri Jul 28 09:31:26 2006
New Revision: 426600

URL: http://svn.apache.org/viewvc?rev=426600&view=rev
Log:
Added assertion utility class

Added:
    lenya/trunk/src/java/org/apache/lenya/util/Assert.java

Added: lenya/trunk/src/java/org/apache/lenya/util/Assert.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/util/Assert.java?rev=426600&view=auto
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/util/Assert.java (added)
+++ lenya/trunk/src/java/org/apache/lenya/util/Assert.java Fri Jul 28 09:31:26 2006
@@ -0,0 +1,44 @@
+/*
+ * Copyright  1999-2004 The Apache Software Foundation
+ *
+ *  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 org.apache.lenya.util;
+
+/**
+ * Assertion utility.
+ */
+public final class Assert {
+
+    /**
+     * @param parameterName The parameter name to use in the exception.
+     * @param object The object.
+     * @throws RuntimeException if the object is null.
+     */
+    public static final void notNull(String parameterName, Object object) {
+        if (object == null) {
+            throw new RuntimeException("The parameter [" + parameterName + "] must not be null!");
+        }
+    }
+
+    /**
+     * @param parameterName The parameter name to use in the exception.
+     * @param object The object.
+     * @throws RuntimeException if the object is null.
+     */
+    public static final void notNull(Object object) {
+        notNull("undefined", object);
+    }
+
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org