directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1418567 - /directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/SetCursor.java
Date Sat, 08 Dec 2012 00:32:07 GMT
Author: elecharny
Date: Sat Dec  8 00:32:07 2012
New Revision: 1418567

URL: http://svn.apache.org/viewvc?rev=1418567&view=rev
Log:
Added a toString() method

Modified:
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/SetCursor.java

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/SetCursor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/SetCursor.java?rev=1418567&r1=1418566&r2=1418567&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/SetCursor.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/SetCursor.java
Sat Dec  8 00:32:07 2012
@@ -417,4 +417,45 @@ public class SetCursor<E> extends Abstra
         
         super.close( cause );
     }
+    
+
+    /**
+     * @see Object#toString()
+     */
+    public String toString( String tabs )
+    {
+        StringBuilder sb = new StringBuilder();
+        
+        sb.append( tabs ).append( "SetCursor :\n" );
+        sb.append( tabs ).append( "    Index : " ).append( index ).append( "\n" );
+
+        if ( ( set != null ) && ( set.length > 0 ) )
+        {
+            sb.append( tabs ).append( "    Size : " ).append( set.length ).append( "\n" );
+
+            int counter = 0; // Don't print more than 100 elements...
+            
+            for ( E e : set )
+            {
+                sb.append( tabs ).append( "    " ).append( e ).append( "\n" );
+                counter++;
+                
+                if (counter == 100 )
+                {
+                    break;
+                }
+            }
+        }
+        
+        return sb.toString();
+    }
+    
+    
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        return toString( "" );
+    }
 }



Mime
View raw message