From a415256cc798baf286d618a2c9ddd427c26a518d Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Mon, 14 Dec 2009 13:21:39 +0000
Subject: [PATCH] Remove optional P parameter from result handlers as it is hardly ever needed in practice and just pollutes the APIs.

---
 sdk/src/org/opends/sdk/AbstractAsynchronousConnection.java |   57 ++++++++++++++++++++++++++++-----------------------------
 1 files changed, 28 insertions(+), 29 deletions(-)

diff --git a/sdk/src/org/opends/sdk/AbstractAsynchronousConnection.java b/sdk/src/org/opends/sdk/AbstractAsynchronousConnection.java
index 58a6f89..905afa6 100644
--- a/sdk/src/org/opends/sdk/AbstractAsynchronousConnection.java
+++ b/sdk/src/org/opends/sdk/AbstractAsynchronousConnection.java
@@ -55,11 +55,11 @@
     AsynchronousConnection
 {
 
-  private static final class SingleEntryFuture<P> implements
-      ResultFuture<SearchResultEntry>, ResultHandler<Result, P>,
-      SearchResultHandler<P>
+  private static final class SingleEntryFuture implements
+      ResultFuture<SearchResultEntry>, ResultHandler<Result>,
+      SearchResultHandler
   {
-    private final ResultHandler<? super SearchResultEntry, P> handler;
+    private final ResultHandler<? super SearchResultEntry> handler;
 
     private volatile SearchResultEntry firstEntry = null;
 
@@ -72,7 +72,7 @@
 
 
     private SingleEntryFuture(
-        ResultHandler<? super SearchResultEntry, P> handler)
+        ResultHandler<? super SearchResultEntry> handler)
     {
       this.handler = handler;
     }
@@ -152,7 +152,7 @@
 
 
 
-    public void handleEntry(P p, SearchResultEntry entry)
+    public void handleEntry(SearchResultEntry entry)
     {
       if (firstEntry == null)
       {
@@ -163,17 +163,17 @@
 
 
 
-    public void handleErrorResult(P p, ErrorResultException error)
+    public void handleErrorResult(ErrorResultException error)
     {
       if (handler != null)
       {
-        handler.handleErrorResult(p, error);
+        handler.handleErrorResult(error);
       }
     }
 
 
 
-    public void handleReference(P p, SearchResultReference reference)
+    public void handleReference(SearchResultReference reference)
     {
       if (firstReference == null)
       {
@@ -183,17 +183,17 @@
 
 
 
-    public void handleResult(P p, Result result)
+    public void handleResult(Result result)
     {
       if (handler != null)
       {
         try
         {
-          handler.handleResult(p, get0());
+          handler.handleResult(get0());
         }
         catch (ErrorResultException e)
         {
-          handler.handleErrorResult(p, e);
+          handler.handleErrorResult(e);
         }
       }
     }
@@ -245,16 +245,16 @@
   /**
    * {@inheritDoc}
    */
-  public <P> ResultFuture<SearchResultEntry> readEntry(DN name,
+  public ResultFuture<SearchResultEntry> readEntry(DN name,
       Collection<String> attributeDescriptions,
-      ResultHandler<? super SearchResultEntry, P> handler, P p)
+      ResultHandler<? super SearchResultEntry> handler)
       throws UnsupportedOperationException, IllegalStateException,
       NullPointerException
   {
     SearchRequest request = Requests.newSearchRequest(name,
         SearchScope.BASE_OBJECT, Filter.getObjectClassPresentFilter())
         .addAttribute(attributeDescriptions);
-    return searchSingleEntry(request, handler, p);
+    return searchSingleEntry(request, handler);
   }
 
 
@@ -262,11 +262,11 @@
   /**
    * {@inheritDoc}
    */
-  public <P> ResultFuture<RootDSE> readRootDSE(
-      ResultHandler<RootDSE, P> handler, P p)
+  public ResultFuture<RootDSE> readRootDSE(
+      ResultHandler<RootDSE> handler)
       throws UnsupportedOperationException, IllegalStateException
   {
-    return RootDSE.readRootDSE(this, handler, p);
+    return RootDSE.readRootDSE(this, handler);
   }
 
 
@@ -274,11 +274,11 @@
   /**
    * {@inheritDoc}
    */
-  public <P> ResultFuture<Schema> readSchema(DN name,
-      ResultHandler<Schema, P> handler, P p)
+  public ResultFuture<Schema> readSchema(DN name,
+      ResultHandler<Schema> handler)
       throws UnsupportedOperationException, IllegalStateException
   {
-    return Schema.readSchema(this, name, handler, p);
+    return Schema.readSchema(this, name, handler);
   }
 
 
@@ -286,11 +286,11 @@
   /**
    * {@inheritDoc}
    */
-  public <P> ResultFuture<Schema> readSchemaForEntry(DN name,
-      ResultHandler<Schema, P> handler, P p)
+  public ResultFuture<Schema> readSchemaForEntry(DN name,
+      ResultHandler<Schema> handler)
       throws UnsupportedOperationException, IllegalStateException
   {
-    return Schema.readSchema(this, name, handler, p);
+    return Schema.readSchema(this, name, handler);
   }
 
 
@@ -298,16 +298,15 @@
   /**
    * {@inheritDoc}
    */
-  public <P> ResultFuture<SearchResultEntry> searchSingleEntry(
+  public ResultFuture<SearchResultEntry> searchSingleEntry(
       SearchRequest request,
-      ResultHandler<? super SearchResultEntry, P> handler, P p)
+      ResultHandler<? super SearchResultEntry> handler)
       throws UnsupportedOperationException, IllegalStateException,
       NullPointerException
   {
-    final SingleEntryFuture<P> innerFuture = new SingleEntryFuture<P>(
-        handler);
+    final SingleEntryFuture innerFuture = new SingleEntryFuture(handler);
     final ResultFuture<Result> future = search(request, innerFuture,
-        innerFuture, p);
+        innerFuture);
     innerFuture.setResultFuture(future);
     return innerFuture;
   }

--
Gitblit v1.10.0