Package org.eclipse.jgit.transport
Class FilterSpec
- java.lang.Object
-
- org.eclipse.jgit.transport.FilterSpec
-
public final class FilterSpec extends java.lang.Object
Represents either a filter specified in a protocol "filter" line, or a placeholder to indicate no filtering.- Since:
- 5.4
-
-
Field Summary
Fields Modifier and Type Field Description private long
blobLimit
static FilterSpec
NO_FILTER
A placeholder that indicates no filtering.private long
treeDepthLimit
-
Constructor Summary
Constructors Modifier Constructor Description private
FilterSpec(long blobLimit, long treeDepthLimit)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
filterLine()
static FilterSpec
fromFilterLine(java.lang.String filterLine)
Process the content of "filter" line from the protocol.long
getBlobLimit()
long
getTreeDepthLimit()
boolean
isNoOp()
(package private) static FilterSpec
withBlobLimit(long blobLimit)
(package private) static FilterSpec
withTreeDepthLimit(long treeDepthLimit)
-
-
-
Field Detail
-
blobLimit
private final long blobLimit
-
treeDepthLimit
private final long treeDepthLimit
-
NO_FILTER
public static final FilterSpec NO_FILTER
A placeholder that indicates no filtering.
-
-
Method Detail
-
fromFilterLine
public static FilterSpec fromFilterLine(java.lang.String filterLine) throws PackProtocolException
Process the content of "filter" line from the protocol. It has a shape like:- "blob:none"
- "blob:limit=N", with N >= 0
- "tree:DEPTH", with DEPTH >= 0
- Parameters:
filterLine
- the content of the "filter" line in the protocol- Returns:
- a FilterSpec representing the given filter
- Throws:
PackProtocolException
- invalid filter because due to unrecognized format or negative/non-numeric filter.
-
withBlobLimit
static FilterSpec withBlobLimit(long blobLimit)
- Parameters:
blobLimit
- the blob limit in a "blob:[limit]" or "blob:none" filter line- Returns:
- a filter spec which filters blobs above a certain size
-
withTreeDepthLimit
static FilterSpec withTreeDepthLimit(long treeDepthLimit)
- Parameters:
treeDepthLimit
- the tree depth limit in a "tree:[depth]" filter line- Returns:
- a filter spec which filters blobs and trees beyond a certain tree depth
-
getBlobLimit
public long getBlobLimit()
- Returns:
- -1 if this filter does not filter blobs based on size, or a non-negative integer representing the max size of blobs to allow
-
getTreeDepthLimit
public long getTreeDepthLimit()
- Returns:
- -1 if this filter does not filter blobs and trees based on depth, or a non-negative integer representing the max tree depth of blobs and trees to fetch
-
isNoOp
public boolean isNoOp()
- Returns:
- true if this filter doesn't filter out anything
-
filterLine
@Nullable public java.lang.String filterLine()
- Returns:
- the filter line which describes this spec, e.g. "filter blob:limit=42"
-
-