From 31392d70a00688cbf0493ab262c21bdb2b7e21a6 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Tue, 22 May 2012 16:28:29 +0000
Subject: [PATCH] Checkpoint basic GET functionality, including example gateway for testing.

---
 opendj-sdk/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Utils.java |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/opendj-sdk/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Utils.java b/opendj-sdk/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Utils.java
index 676562d..e0cdf90 100644
--- a/opendj-sdk/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Utils.java
+++ b/opendj-sdk/opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Utils.java
@@ -36,7 +36,7 @@
 /**
  *
  */
-public final class Utils {
+final class Utils {
 
     private static final Function<ByteString, Object, Syntax> BYTESTRING_TO_JSON =
             new Function<ByteString, Object, Syntax>() {
@@ -72,18 +72,32 @@
         }
     }
 
-    public static Object attributeToJson(Attribute a) {
+    static Object attributeToJson(Attribute a) {
         Syntax syntax = a.getAttributeDescription().getAttributeType().getSyntax();
         Function<ByteString, Object, Void> f = Functions.fixedFunction(BYTESTRING_TO_JSON, syntax);
         boolean isSingleValued = a.getAttributeDescription().getAttributeType().isSingleValue();
         return isSingleValued ? a.parse().as(f) : asList(a.parse().asSetOf(f));
     }
 
-    public static String getAttributeName(Attribute a) {
+    static String getAttributeName(Attribute a) {
         return a.getAttributeDescription().withoutOption("binary").toString();
     }
 
-    public static String toLowerCase(String s) {
+    static String toLowerCase(String s) {
         return s != null ? s.toLowerCase(Locale.ENGLISH) : null;
     }
+
+    static <T> T ensureNotNull(final T object) {
+        if (object == null) {
+            throw new NullPointerException();
+        }
+        return object;
+    }
+
+    static <T> T ensureNotNull(final T object, final String message) {
+        if (object == null) {
+            throw new NullPointerException(message);
+        }
+        return object;
+    }
 }

--
Gitblit v1.10.0