]> source.dussan.org Git - jgit.git/commitdiff
Add ObjectReader.Filter, like in ObjectInserter 58/71358/2
authorDave Borowitz <dborowitz@google.com>
Mon, 25 Apr 2016 17:28:43 +0000 (13:28 -0400)
committerDave Borowitz <dborowitz@google.com>
Mon, 25 Apr 2016 17:36:38 +0000 (13:36 -0400)
Change-Id: If34ad8185dc8192435e622995fdca598b86add7e

org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReader.java

index 77cfb038cc288a65da829307d025f15a21f6b149..99661a8d66180ed8f86d35d2b431c7fb08c9e261 100644 (file)
@@ -431,4 +431,102 @@ public abstract class ObjectReader implements AutoCloseable {
         */
        @Override
        public abstract void close();
+
+       /**
+        * Wraps a delegate ObjectReader.
+        *
+        * @since 4.4
+        */
+       public static abstract class Filter extends ObjectReader {
+               /**
+                * @return delegate ObjectReader to handle all processing.
+                * @since 4.4
+                */
+               protected abstract ObjectReader delegate();
+
+               @Override
+               public ObjectReader newReader() {
+                       return delegate().newReader();
+               }
+
+               @Override
+               public AbbreviatedObjectId abbreviate(AnyObjectId objectId)
+                               throws IOException {
+                       return delegate().abbreviate(objectId);
+               }
+
+               @Override
+               public AbbreviatedObjectId abbreviate(AnyObjectId objectId, int len)
+                               throws IOException {
+                       return delegate().abbreviate(objectId, len);
+               }
+
+               @Override
+               public Collection<ObjectId> resolve(AbbreviatedObjectId id)
+                               throws IOException {
+                       return delegate().resolve(id);
+               }
+
+               @Override
+               public boolean has(AnyObjectId objectId) throws IOException {
+                       return delegate().has(objectId);
+               }
+
+               @Override
+               public boolean has(AnyObjectId objectId, int typeHint) throws IOException {
+                       return delegate().has(objectId, typeHint);
+               }
+
+               @Override
+               public ObjectLoader open(AnyObjectId objectId)
+                               throws MissingObjectException, IOException {
+                       return delegate().open(objectId);
+               }
+
+               @Override
+               public ObjectLoader open(AnyObjectId objectId, int typeHint)
+                               throws MissingObjectException, IncorrectObjectTypeException,
+                               IOException {
+                       return delegate().open(objectId, typeHint);
+               }
+
+               @Override
+               public Set<ObjectId> getShallowCommits() throws IOException {
+                       return delegate().getShallowCommits();
+               }
+
+               @Override
+               public <T extends ObjectId> AsyncObjectLoaderQueue<T> open(
+                               Iterable<T> objectIds, boolean reportMissing) {
+                       return delegate().open(objectIds, reportMissing);
+               }
+
+               @Override
+               public long getObjectSize(AnyObjectId objectId, int typeHint)
+                               throws MissingObjectException, IncorrectObjectTypeException,
+                               IOException {
+                       return delegate().getObjectSize(objectId, typeHint);
+               }
+
+               @Override
+               public <T extends ObjectId> AsyncObjectSizeQueue<T> getObjectSize(
+                               Iterable<T> objectIds, boolean reportMissing) {
+                       return delegate().getObjectSize(objectIds, reportMissing);
+               }
+
+               @Override
+               public void setAvoidUnreachableObjects(boolean avoid) {
+                       delegate().setAvoidUnreachableObjects(avoid);
+               }
+
+               @Override
+               public BitmapIndex getBitmapIndex() throws IOException {
+                       return delegate().getBitmapIndex();
+               }
+
+               @Override
+               public void close() {
+                       delegate().close();
+               }
+       }
 }