jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r988147 - /jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/
Date Mon, 23 Aug 2010 15:17:03 GMT
Author: jukka
Date: Mon Aug 23 15:16:49 2010
New Revision: 988147

URL: http://svn.apache.org/viewvc?rev=988147&view=rev
Log:
JCR-2722: Add a filtered RangeIterator

Add convenience constructors to allow the use of predicates with all the RangeIteratorAdapter
subclasses.

Use generics in declarations.

Modified:
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/AccessControlPolicyIteratorAdapter.java
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/EventIteratorAdapter.java
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/EventListenerIteratorAdapter.java
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/FilteredRangeIterator.java
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/NodeIteratorAdapter.java
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/NodeTypeIteratorAdapter.java
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/PropertyIteratorAdapter.java
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/RangeIteratorAdapter.java
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/RowIteratorAdapter.java
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/VersionIteratorAdapter.java

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/AccessControlPolicyIteratorAdapter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/AccessControlPolicyIteratorAdapter.java?rev=988147&r1=988146&r2=988147&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/AccessControlPolicyIteratorAdapter.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/AccessControlPolicyIteratorAdapter.java
Mon Aug 23 15:16:49 2010
@@ -16,13 +16,16 @@
  */
 package org.apache.jackrabbit.commons.iterator;
 
-import javax.jcr.RangeIterator;
-import javax.jcr.security.AccessControlPolicy;
-import javax.jcr.security.AccessControlPolicyIterator;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.NoSuchElementException;
 
+import javax.jcr.RangeIterator;
+import javax.jcr.security.AccessControlPolicy;
+import javax.jcr.security.AccessControlPolicyIterator;
+
+import org.apache.jackrabbit.commons.predicate.Predicate;
+
 /**
  * Adapter class for turning {@link RangeIterator}s or {@link Iterator}s
  * into {@link AccessControlPolicyIteratorAdapter}s.
@@ -37,21 +40,25 @@ public class AccessControlPolicyIterator
         new AccessControlPolicyIteratorAdapter(RangeIteratorAdapter.EMPTY);
 
     /**
-     * Creates an adapter for the given {@link RangeIterator}.
+     * Creates an adapter for the given {@link Iterator}.
      *
      * @param iterator iterator of {@link AccessControlPolicy access control policies}.
      */
-    public AccessControlPolicyIteratorAdapter(RangeIterator iterator) {
-        super(iterator);
+    public AccessControlPolicyIteratorAdapter(Iterator<?> iterator) {
+        super(RangeIteratorAdapter.adapt(iterator));
     }
 
     /**
-     * Creates an adapter for the given {@link Iterator}.
+     * Creates a filtered adapter for the given {@link Iterator}
+     * and {@link Predicate).
      *
-     * @param iterator iterator of {@link AccessControlPolicy access control policies}.
+     * @since Apache Jackrabbit 2.2
+     * @param iterator access control policy iterator
+     * @param predicate filtering predicate
      */
-    public AccessControlPolicyIteratorAdapter(Iterator iterator) {
-        super(new RangeIteratorAdapter(iterator));
+    public AccessControlPolicyIteratorAdapter(
+            Iterator<?> iterator, Predicate predicate) {
+        super(new FilteredRangeIterator(iterator, predicate));
     }
 
     /**
@@ -59,7 +66,7 @@ public class AccessControlPolicyIterator
      *
      * @param collection collection of {@link AccessControlPolicy} objects.
      */
-    public AccessControlPolicyIteratorAdapter(Collection collection) {
+    public AccessControlPolicyIteratorAdapter(Collection<?> collection) {
         super(new RangeIteratorAdapter(collection));
     }
 

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/EventIteratorAdapter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/EventIteratorAdapter.java?rev=988147&r1=988146&r2=988147&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/EventIteratorAdapter.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/EventIteratorAdapter.java
Mon Aug 23 15:16:49 2010
@@ -24,6 +24,8 @@ import javax.jcr.RangeIterator;
 import javax.jcr.observation.Event;
 import javax.jcr.observation.EventIterator;
 
+import org.apache.jackrabbit.commons.predicate.Predicate;
+
 /**
  * Adapter class for turning {@link RangeIterator}s or {@link Iterator}s
  * into {@link EventIterator}s.
@@ -41,21 +43,24 @@ public class EventIteratorAdapter extend
     }
 
     /**
-     * Creates an adapter for the given {@link RangeIterator}.
+     * Creates an adapter for the given {@link Iterator}.
      *
-     * @param iterator iterator of {@link Event}s
+     * @param iterator iterator of {@link Event}s.
      */
-    public EventIteratorAdapter(RangeIterator iterator) {
-        super(iterator);
+    public EventIteratorAdapter(Iterator<?> iterator) {
+        super(RangeIteratorAdapter.adapt(iterator));
     }
 
     /**
-     * Creates an adapter for the given {@link Iterator}.
+     * Creates a filtered adapter for the given {@link Iterator}
+     * and {@link Predicate).
      *
-     * @param iterator iterator of {@link Event}s.
+     * @since Apache Jackrabbit 2.2
+     * @param iterator event iterator
+     * @param predicate filtering predicate
      */
-    public EventIteratorAdapter(Iterator iterator) {
-        super(new RangeIteratorAdapter(iterator));
+    public EventIteratorAdapter(Iterator<?> iterator, Predicate predicate) {
+        super(new FilteredRangeIterator(iterator, predicate));
     }
 
     /**
@@ -63,7 +68,7 @@ public class EventIteratorAdapter extend
      *
      * @param collection collection of {@link Event}s
      */
-    public EventIteratorAdapter(Collection collection) {
+    public EventIteratorAdapter(Collection<?> collection) {
         super(new RangeIteratorAdapter(collection));
     }
 

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/EventListenerIteratorAdapter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/EventListenerIteratorAdapter.java?rev=988147&r1=988146&r2=988147&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/EventListenerIteratorAdapter.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/EventListenerIteratorAdapter.java
Mon Aug 23 15:16:49 2010
@@ -24,6 +24,8 @@ import javax.jcr.RangeIterator;
 import javax.jcr.observation.EventListener;
 import javax.jcr.observation.EventListenerIterator;
 
+import org.apache.jackrabbit.commons.predicate.Predicate;
+
 /**
  * Adapter class for turning {@link RangeIterator}s or {@link Iterator}s
  * into {@link EventListenerIterator}s.
@@ -38,21 +40,25 @@ public class EventListenerIteratorAdapte
         new EventListenerIteratorAdapter(RangeIteratorAdapter.EMPTY);
 
     /**
-     * Creates an adapter for the given {@link RangeIterator}.
+     * Creates an adapter for the given {@link Iterator}.
      *
      * @param iterator iterator of {@link EventListener}s
      */
-    public EventListenerIteratorAdapter(RangeIterator iterator) {
-        super(iterator);
+    public EventListenerIteratorAdapter(Iterator<?> iterator) {
+        super(RangeIteratorAdapter.adapt(iterator));
     }
 
     /**
-     * Creates an adapter for the given {@link Iterator}.
+     * Creates a filtered adapter for the given {@link Iterator}
+     * and {@link Predicate).
      *
-     * @param iterator iterator of {@link EventListener}s
+     * @since Apache Jackrabbit 2.2
+     * @param iterator event listener iterator
+     * @param predicate filtering predicate
      */
-    public EventListenerIteratorAdapter(Iterator iterator) {
-        super(new RangeIteratorAdapter(iterator));
+    public EventListenerIteratorAdapter(
+            Iterator<?> iterator, Predicate predicate) {
+        super(new FilteredRangeIterator(iterator, predicate));
     }
 
     /**
@@ -60,7 +66,7 @@ public class EventListenerIteratorAdapte
      *
      * @param collection collection of {@link EventListener}s
      */
-    public EventListenerIteratorAdapter(Collection collection) {
+    public EventListenerIteratorAdapter(Collection<?> collection) {
         super(new RangeIteratorAdapter(collection));
     }
 

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/FilteredRangeIterator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/FilteredRangeIterator.java?rev=988147&r1=988146&r2=988147&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/FilteredRangeIterator.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/FilteredRangeIterator.java
Mon Aug 23 15:16:49 2010
@@ -25,6 +25,8 @@ import org.apache.jackrabbit.commons.pre
 
 /**
  * Filtering decorator for iterators.
+ *
+ * @since Apache Jackrabbit 2.2
  */
 public class FilteredRangeIterator implements RangeIterator {
 

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/NodeIteratorAdapter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/NodeIteratorAdapter.java?rev=988147&r1=988146&r2=988147&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/NodeIteratorAdapter.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/NodeIteratorAdapter.java
Mon Aug 23 15:16:49 2010
@@ -24,6 +24,8 @@ import javax.jcr.Node;
 import javax.jcr.NodeIterator;
 import javax.jcr.RangeIterator;
 
+import org.apache.jackrabbit.commons.predicate.Predicate;
+
 /**
  * Adapter class for turning {@link RangeIterator}s or {@link Iterator}s
  * into {@link NodeIterator}s.
@@ -38,21 +40,24 @@ public class NodeIteratorAdapter extends
         new NodeIteratorAdapter(RangeIteratorAdapter.EMPTY);
 
     /**
-     * Creates an adapter for the given {@link RangeIterator}.
+     * Creates an adapter for the given {@link Iterator}.
      *
      * @param iterator iterator of {@link Node}s
      */
-    public NodeIteratorAdapter(RangeIterator iterator) {
-        super(iterator);
+    public NodeIteratorAdapter(Iterator<?> iterator) {
+        super(RangeIteratorAdapter.adapt(iterator));
     }
 
     /**
-     * Creates an adapter for the given {@link Iterator}.
+     * Creates a filtered adapter for the given {@link Iterator}
+     * and {@link Predicate).
      *
-     * @param iterator iterator of {@link Node}s
+     * @since Apache Jackrabbit 2.2
+     * @param iterator node iterator
+     * @param predicate filtering predicate
      */
-    public NodeIteratorAdapter(Iterator iterator) {
-        super(new RangeIteratorAdapter(iterator));
+    public NodeIteratorAdapter(Iterator<?> iterator, Predicate predicate) {
+        super(new FilteredRangeIterator(iterator, predicate));
     }
 
     /**
@@ -60,7 +65,7 @@ public class NodeIteratorAdapter extends
      *
      * @param collection collection of {@link Node}s
      */
-    public NodeIteratorAdapter(Collection collection) {
+    public NodeIteratorAdapter(Collection<?> collection) {
         super(new RangeIteratorAdapter(collection));
     }
 

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/NodeTypeIteratorAdapter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/NodeTypeIteratorAdapter.java?rev=988147&r1=988146&r2=988147&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/NodeTypeIteratorAdapter.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/NodeTypeIteratorAdapter.java
Mon Aug 23 15:16:49 2010
@@ -24,6 +24,8 @@ import javax.jcr.RangeIterator;
 import javax.jcr.nodetype.NodeType;
 import javax.jcr.nodetype.NodeTypeIterator;
 
+import org.apache.jackrabbit.commons.predicate.Predicate;
+
 /**
  * Adapter class for turning {@link RangeIterator}s or {@link Iterator}s
  * into {@link NodeTypeIterator}s.
@@ -38,21 +40,24 @@ public class NodeTypeIteratorAdapter ext
         new NodeTypeIteratorAdapter(RangeIteratorAdapter.EMPTY);
 
     /**
-     * Creates an adapter for the given {@link RangeIterator}.
+     * Creates an adapter for the given {@link Iterator}.
      *
      * @param iterator iterator of {@link NodeType}s
      */
-    public NodeTypeIteratorAdapter(RangeIterator iterator) {
-        super(iterator);
+    public NodeTypeIteratorAdapter(Iterator<?> iterator) {
+        super(RangeIteratorAdapter.adapt(iterator));
     }
 
     /**
-     * Creates an adapter for the given {@link Iterator}.
+     * Creates a filtered adapter for the given {@link Iterator}
+     * and {@link Predicate).
      *
-     * @param iterator iterator of {@link NodeType}s
+     * @since Apache Jackrabbit 2.2
+     * @param iterator node type iterator
+     * @param predicate filtering predicate
      */
-    public NodeTypeIteratorAdapter(Iterator iterator) {
-        super(new RangeIteratorAdapter(iterator));
+    public NodeTypeIteratorAdapter(Iterator<?> iterator, Predicate predicate) {
+        super(new FilteredRangeIterator(iterator, predicate));
     }
 
     /**
@@ -60,7 +65,7 @@ public class NodeTypeIteratorAdapter ext
      *
      * @param collection collection of {@link NodeType}s
      */
-    public NodeTypeIteratorAdapter(Collection<NodeType> collection) {
+    public NodeTypeIteratorAdapter(Collection<?> collection) {
         super(new RangeIteratorAdapter(collection));
     }
 

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/PropertyIteratorAdapter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/PropertyIteratorAdapter.java?rev=988147&r1=988146&r2=988147&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/PropertyIteratorAdapter.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/PropertyIteratorAdapter.java
Mon Aug 23 15:16:49 2010
@@ -24,6 +24,8 @@ import javax.jcr.Property;
 import javax.jcr.PropertyIterator;
 import javax.jcr.RangeIterator;
 
+import org.apache.jackrabbit.commons.predicate.Predicate;
+
 /**
  * Adapter class for turning {@link RangeIterator}s or {@link Iterator}s
  * into {@link PropertyIterator}s.
@@ -38,21 +40,24 @@ public class PropertyIteratorAdapter ext
         new PropertyIteratorAdapter(RangeIteratorAdapter.EMPTY);
 
     /**
-     * Creates an adapter for the given {@link RangeIterator}.
+     * Creates an adapter for the given {@link Iterator}.
      *
      * @param iterator iterator of {@link Property} instances
      */
-    public PropertyIteratorAdapter(RangeIterator iterator) {
-        super(iterator);
+    public PropertyIteratorAdapter(Iterator<?> iterator) {
+        super(RangeIteratorAdapter.adapt(iterator));
     }
 
     /**
-     * Creates an adapter for the given {@link Iterator}.
+     * Creates a filtered adapter for the given {@link Iterator}
+     * and {@link Predicate).
      *
-     * @param iterator iterator of {@link Property} instances
+     * @since Apache Jackrabbit 2.2
+     * @param iterator property iterator
+     * @param predicate filtering predicate
      */
-    public PropertyIteratorAdapter(Iterator iterator) {
-        super(new RangeIteratorAdapter(iterator));
+    public PropertyIteratorAdapter(Iterator<?> iterator, Predicate predicate) {
+        super(new FilteredRangeIterator(iterator, predicate));
     }
 
     /**
@@ -60,7 +65,7 @@ public class PropertyIteratorAdapter ext
      *
      * @param collection collection of {@link Property} instances
      */
-    public PropertyIteratorAdapter(Collection collection) {
+    public PropertyIteratorAdapter(Collection<?> collection) {
         super(new RangeIteratorAdapter(collection));
     }
 

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/RangeIteratorAdapter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/RangeIteratorAdapter.java?rev=988147&r1=988146&r2=988147&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/RangeIteratorAdapter.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/RangeIteratorAdapter.java
Mon Aug 23 15:16:49 2010
@@ -37,9 +37,26 @@ public class RangeIteratorAdapter implem
         new RangeIteratorAdapter(Collections.EMPTY_LIST);
 
     /**
+     * Adapts the given iterator into a range iterator. The given
+     * instance is returned as-is if it already implements the
+     * {@link RangeIterator} interface. Otherwise the iterator is
+     * wrapped into a {@link RangeIteratorAdapter} instance.
+     * 
+     * @param iterator iterator to adapt
+     * @return adapted iterator
+     */
+    public static RangeIterator adapt(Iterator<?> iterator) {
+        if (iterator instanceof RangeIterator) {
+            return (RangeIterator) iterator;
+        } else {
+            return new RangeIteratorAdapter(iterator, -1);
+        }
+    }
+
+    /**
      * The adapted iterator instance.
      */
-    private final Iterator iterator;
+    private final Iterator<?> iterator;
 
     /**
      * Number of elements in the adapted iterator, or -1 if unknown.
@@ -57,7 +74,7 @@ public class RangeIteratorAdapter implem
      * @param iterator adapted iterator
      * @param size size of the iterator, or -1 if unknown
      */
-    public RangeIteratorAdapter(Iterator iterator, long size) {
+    public RangeIteratorAdapter(Iterator<?> iterator, long size) {
         this.iterator = iterator;
         this.size = size;
         this.position = 0;
@@ -68,7 +85,7 @@ public class RangeIteratorAdapter implem
      *
      * @param iterator adapted iterator
      */
-    public RangeIteratorAdapter(Iterator iterator) {
+    public RangeIteratorAdapter(Iterator<?> iterator) {
         this(iterator, -1);
     }
 
@@ -77,7 +94,7 @@ public class RangeIteratorAdapter implem
      *
      * @param collection the collection to iterate
      */
-    public RangeIteratorAdapter(Collection collection) {
+    public RangeIteratorAdapter(Collection<?> collection) {
         this(collection.iterator(), collection.size());
     }
 

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/RowIteratorAdapter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/RowIteratorAdapter.java?rev=988147&r1=988146&r2=988147&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/RowIteratorAdapter.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/RowIteratorAdapter.java
Mon Aug 23 15:16:49 2010
@@ -24,6 +24,8 @@ import javax.jcr.RangeIterator;
 import javax.jcr.query.Row;
 import javax.jcr.query.RowIterator;
 
+import org.apache.jackrabbit.commons.predicate.Predicate;
+
 /**
  * Adapter class for turning {@link RangeIterator}s or {@link Iterator}s
  * into {@link RowIterator}s.
@@ -51,8 +53,20 @@ public class RowIteratorAdapter extends 
      *
      * @param iterator iterator of {@link Row}s
      */
-    public RowIteratorAdapter(Iterator iterator) {
-        super(new RangeIteratorAdapter(iterator));
+    public RowIteratorAdapter(Iterator<?> iterator) {
+        super(RangeIteratorAdapter.adapt(iterator));
+    }
+
+    /**
+     * Creates a filtered adapter for the given {@link Iterator}
+     * and {@link Predicate).
+     *
+     * @since Apache Jackrabbit 2.2
+     * @param iterator row iterator
+     * @param predicate filtering predicate
+     */
+    public RowIteratorAdapter(Iterator<?> iterator, Predicate predicate) {
+        super(new FilteredRangeIterator(iterator, predicate));
     }
 
     /**
@@ -60,7 +74,7 @@ public class RowIteratorAdapter extends 
      *
      * @param collection collection of {@link Row}s
      */
-    public RowIteratorAdapter(Collection collection) {
+    public RowIteratorAdapter(Collection<?> collection) {
         super(new RangeIteratorAdapter(collection));
     }
 

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/VersionIteratorAdapter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/VersionIteratorAdapter.java?rev=988147&r1=988146&r2=988147&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/VersionIteratorAdapter.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/VersionIteratorAdapter.java
Mon Aug 23 15:16:49 2010
@@ -24,6 +24,8 @@ import javax.jcr.RangeIterator;
 import javax.jcr.version.Version;
 import javax.jcr.version.VersionIterator;
 
+import org.apache.jackrabbit.commons.predicate.Predicate;
+
 /**
  * Adapter class for turning {@link RangeIterator}s or {@link Iterator}s
  * into {@link VersionIterator}s.
@@ -38,21 +40,24 @@ public class VersionIteratorAdapter exte
         new VersionIteratorAdapter(RangeIteratorAdapter.EMPTY);
 
     /**
-     * Creates an adapter for the given {@link RangeIterator}.
+     * Creates an adapter for the given {@link Iterator}.
      *
      * @param iterator iterator of {@link Version}s
      */
-    public VersionIteratorAdapter(RangeIterator iterator) {
-        super(iterator);
+    public VersionIteratorAdapter(Iterator<?> iterator) {
+        super(RangeIteratorAdapter.adapt(iterator));
     }
 
     /**
-     * Creates an adapter for the given {@link Iterator}.
+     * Creates a filtered adapter for the given {@link Iterator}
+     * and {@link Predicate).
      *
-     * @param iterator iterator of {@link Version}s
+     * @since Apache Jackrabbit 2.2
+     * @param iterator version iterator
+     * @param predicate filtering predicate
      */
-    public VersionIteratorAdapter(Iterator iterator) {
-        super(new RangeIteratorAdapter(iterator));
+    public VersionIteratorAdapter(Iterator<?> iterator, Predicate predicate) {
+        super(new FilteredRangeIterator(iterator, predicate));
     }
 
     /**
@@ -60,7 +65,7 @@ public class VersionIteratorAdapter exte
      *
      * @param collection collection of {@link Version}s
      */
-    public VersionIteratorAdapter(Collection collection) {
+    public VersionIteratorAdapter(Collection<?> collection) {
         super(new RangeIteratorAdapter(collection));
     }
 



Mime
View raw message