directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r224599 - /directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/SearchResultReference.java
Date Sun, 24 Jul 2005 10:19:04 GMT
Author: elecharny
Date: Sun Jul 24 03:19:02 2005
New Revision: 224599

URL: http://svn.apache.org/viewcvs?rev=224599&view=rev
Log:
- Added a toString method
- fixed the javadoc

Modified:
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/SearchResultReference.java

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/SearchResultReference.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/SearchResultReference.java?rev=224599&r1=224598&r2=224599&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/SearchResultReference.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/SearchResultReference.java
Sun Jul 24 03:19:02 2005
@@ -20,6 +20,8 @@
 import org.apache.asn1.ldap.codec.primitives.LdapURL;
 
 import java.util.ArrayList;
+import java.util.Iterator;
+
 
 /**
  * A SearchResultReference Message. Its syntax is :
@@ -49,12 +51,13 @@
 
     /**
      * Add a new reference to the list.
-     */
-    public void addSearchResultReference(LdapURL searchResultReference)
+     * @param searchResultReference The search result reference
+    */
+    public void addSearchResultReference( LdapURL searchResultReference )
     {
-        searchResultReferences.add(searchResultReference);
+        searchResultReferences.add( searchResultReference );
     }
-    
+
     /**
      * Get the list of references
      * @return An ArrayList of SearchResultReferences
@@ -62,5 +65,37 @@
     public ArrayList getSearchResultReferences()
     {
         return searchResultReferences;
+    }
+
+    /**
+     * Returns the Search Result Reference string
+     *
+     * @return The Search Result Reference string 
+     */
+    public String toString()
+    {
+
+        StringBuffer sb = new StringBuffer();
+
+        sb.append( "    Search Result Reference\n" );
+
+        if ( ( searchResultReferences == null ) || ( searchResultReferences.size() == 0 )
)
+        {
+            sb.append( "        No Reference\n" );
+        }
+        else
+        {
+            sb.append( "        References\n" );
+
+            Iterator referencesIterator = searchResultReferences.iterator();
+
+            while ( referencesIterator.hasNext() )
+            {
+                sb.append( "            '" )
+                  .append( ( ( LdapURL ) referencesIterator.next() ).toString() ).append(
"'\n" );
+            }
+        }
+
+        return sb.toString();
     }
 }



Mime
View raw message