From 263d085885df024dca9250cc03c807912b0a7662 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Tue, 24 Apr 2012 22:33:21 +0000
Subject: [PATCH] Reformat to comply with new Checkstyle rules.
---
opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Validator.java | 300 ++++++++++++++++++++++++++---------------------------------
1 files changed, 133 insertions(+), 167 deletions(-)
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Validator.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Validator.java
index c300e16..ae1a727 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Validator.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/Validator.java
@@ -6,17 +6,16 @@
* (the "License"). You may not use this file except in compliance
* with the License.
*
- * You can obtain a copy of the license at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* or http://forgerock.org/license/CDDLv1.0.html.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opendj3/legal-notices/CDDLv1_0.txt. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
@@ -28,183 +27,150 @@
package com.forgerock.opendj.util;
-
-
/**
* Common methods for validating method arguments.
*/
-public final class Validator
-{
+public final class Validator {
- /**
- * Throws a {@code NullPointerException} if any of the provided arguments are
- * {@code null}.
- *
- * @param objects
- * The objects to test.
- * @throws NullPointerException
- * If any of the provided arguments are {@code null}.
- */
- public static void ensureNotNull(final Object... objects)
- {
- for (final Object o : objects)
- {
- if (o == null)
- {
- throw new NullPointerException();
- }
+ /**
+ * Throws a {@code NullPointerException} if any of the provided arguments
+ * are {@code null}.
+ *
+ * @param objects
+ * The objects to test.
+ * @throws NullPointerException
+ * If any of the provided arguments are {@code null}.
+ */
+ public static void ensureNotNull(final Object... objects) {
+ for (final Object o : objects) {
+ if (o == null) {
+ throw new NullPointerException();
+ }
+ }
}
- }
-
-
- /**
- * Throws a {@code NullPointerException} if any of the provided arguments are
- * {@code null}.
- *
- * @param o1
- * The first object to test.
- * @param o2
- * The second object to test.
- * @throws NullPointerException
- * If any of the provided arguments are {@code null}.
- */
- public static void ensureNotNull(final Object o1, final Object o2)
- {
- if (o1 == null || o2 == null)
- {
- throw new NullPointerException();
+ /**
+ * Throws a {@code NullPointerException} if any of the provided arguments
+ * are {@code null}.
+ *
+ * @param o1
+ * The first object to test.
+ * @param o2
+ * The second object to test.
+ * @throws NullPointerException
+ * If any of the provided arguments are {@code null}.
+ */
+ public static void ensureNotNull(final Object o1, final Object o2) {
+ if (o1 == null || o2 == null) {
+ throw new NullPointerException();
+ }
}
- }
-
-
- /**
- * Throws a {@code NullPointerException} if any of the provided arguments are
- * {@code null}.
- *
- * @param o1
- * The first object to test.
- * @param o2
- * The second object to test.
- * @param o3
- * The third object to test.
- * @throws NullPointerException
- * If any of the provided arguments are {@code null}.
- */
- public static void ensureNotNull(final Object o1, final Object o2,
- final Object o3)
- {
- if (o1 == null || o2 == null || o3 == null)
- {
- throw new NullPointerException();
+ /**
+ * Throws a {@code NullPointerException} if any of the provided arguments
+ * are {@code null}.
+ *
+ * @param o1
+ * The first object to test.
+ * @param o2
+ * The second object to test.
+ * @param o3
+ * The third object to test.
+ * @throws NullPointerException
+ * If any of the provided arguments are {@code null}.
+ */
+ public static void ensureNotNull(final Object o1, final Object o2, final Object o3) {
+ if (o1 == null || o2 == null || o3 == null) {
+ throw new NullPointerException();
+ }
}
- }
-
-
- /**
- * Throws a {@code NullPointerException} if any of the provided arguments are
- * {@code null}.
- *
- * @param o1
- * The first object to test.
- * @param o2
- * The second object to test.
- * @param o3
- * The third object to test.
- * @param o4
- * The fourth object to test.
- * @throws NullPointerException
- * If any of the provided arguments are {@code null}.
- */
- public static void ensureNotNull(final Object o1, final Object o2,
- final Object o3, final Object o4)
- {
- if (o1 == null || o2 == null || o3 == null || o4 == null)
- {
- throw new NullPointerException();
+ /**
+ * Throws a {@code NullPointerException} if any of the provided arguments
+ * are {@code null}.
+ *
+ * @param o1
+ * The first object to test.
+ * @param o2
+ * The second object to test.
+ * @param o3
+ * The third object to test.
+ * @param o4
+ * The fourth object to test.
+ * @throws NullPointerException
+ * If any of the provided arguments are {@code null}.
+ */
+ public static void ensureNotNull(final Object o1, final Object o2, final Object o3,
+ final Object o4) {
+ if (o1 == null || o2 == null || o3 == null || o4 == null) {
+ throw new NullPointerException();
+ }
}
- }
-
-
- /**
- * Throws a {@code NullPointerException} if any of the provided arguments are
- * {@code null}.
- *
- * @param o1
- * The first object to test.
- * @param o2
- * The second object to test.
- * @param o3
- * The third object to test.
- * @param o4
- * The fourth object to test.
- * @param o5
- * The fifth object to test.
- * @throws NullPointerException
- * If any of the provided arguments are {@code null}.
- */
- public static void ensureNotNull(final Object o1, final Object o2,
- final Object o3, final Object o4, final Object o5)
- {
- if (o1 == null || o2 == null || o3 == null || o4 == null || o5 == null)
- {
- throw new NullPointerException();
+ /**
+ * Throws a {@code NullPointerException} if any of the provided arguments
+ * are {@code null}.
+ *
+ * @param o1
+ * The first object to test.
+ * @param o2
+ * The second object to test.
+ * @param o3
+ * The third object to test.
+ * @param o4
+ * The fourth object to test.
+ * @param o5
+ * The fifth object to test.
+ * @throws NullPointerException
+ * If any of the provided arguments are {@code null}.
+ */
+ public static void ensureNotNull(final Object o1, final Object o2, final Object o3,
+ final Object o4, final Object o5) {
+ if (o1 == null || o2 == null || o3 == null || o4 == null || o5 == null) {
+ throw new NullPointerException();
+ }
}
- }
-
-
- /**
- * Throws a {@code NullPointerException} if the provided argument is {@code
- * null}. This method returns a reference to its single parameter so that it
- * can be easily used in constructors.
- *
- * @param <T>
- * The type of {@code o1}.
- * @param o1
- * The object to test.
- * @return A reference to {@code o1}.
- * @throws NullPointerException
- * If the provided argument is {@code null}.
- */
- public static <T> T ensureNotNull(final T o1)
- {
- if (o1 == null)
- {
- throw new NullPointerException();
+ /**
+ * Throws a {@code NullPointerException} if the provided argument is
+ * {@code null}. This method returns a reference to its single parameter so
+ * that it can be easily used in constructors.
+ *
+ * @param <T>
+ * The type of {@code o1}.
+ * @param o1
+ * The object to test.
+ * @return A reference to {@code o1}.
+ * @throws NullPointerException
+ * If the provided argument is {@code null}.
+ */
+ public static <T> T ensureNotNull(final T o1) {
+ if (o1 == null) {
+ throw new NullPointerException();
+ }
+ return o1;
}
- return o1;
- }
-
-
- /**
- * Throws an {@code IllegalArgumentException} if the provided condition is
- * {@code false}.
- *
- * @param condition
- * The condition, which must be {@code true} to avoid an exception.
- * @param message
- * The error message to include in the exception if it is thrown.
- * @throws IllegalArgumentException
- * If {@code condition} was {@code false}.
- */
- public static void ensureTrue(final boolean condition, final String message)
- {
- if (!condition)
- {
- throw new IllegalArgumentException(message);
+ /**
+ * Throws an {@code IllegalArgumentException} if the provided condition is
+ * {@code false}.
+ *
+ * @param condition
+ * The condition, which must be {@code true} to avoid an
+ * exception.
+ * @param message
+ * The error message to include in the exception if it is thrown.
+ * @throws IllegalArgumentException
+ * If {@code condition} was {@code false}.
+ */
+ public static void ensureTrue(final boolean condition, final String message) {
+ if (!condition) {
+ throw new IllegalArgumentException(message);
+ }
}
- }
-
-
- // Prevent instantiation.
- private Validator()
- {
- // No implementation required.
- }
+ // Prevent instantiation.
+ private Validator() {
+ // No implementation required.
+ }
}
--
Gitblit v1.10.0