Browse Source

Introduce ObjectLoader.Filter for delegation

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: I78ada3f4023c4304b19f94fb044024f0f0b2cbbe
stable-4.10
Han-Wen Nienhuys 7 years ago
parent
commit
2b444d781c
  1. 38
      org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectLoader.java

38
org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectLoader.java

@ -323,4 +323,42 @@ public abstract class ObjectLoader {
return new ObjectStream.SmallStream(this);
}
}
/**
* Wraps a delegate ObjectLoader.
*
* @since 4.10
*/
public static abstract class Filter extends ObjectLoader {
/**
* @return delegate ObjectLoader to handle all processing.
* @since 4.10
*/
protected abstract ObjectLoader delegate();
@Override
public int getType() {
return delegate().getType();
}
@Override
public long getSize() {
return delegate().getSize();
}
@Override
public boolean isLarge() {
return delegate().isLarge();
}
@Override
public byte[] getCachedBytes() {
return delegate().getCachedBytes();
}
@Override
public ObjectStream openStream() throws IOException {
return delegate().openStream();
}
}
}

Loading…
Cancel
Save