This is an abstract interface. Applications may implement a subclass, or use one of the predefined implementations already available within this package.
Unless specifically noted otherwise a TreeFilter implementation is not thread
safe and may not be shared by different TreeWalk instances at the same time.
This restriction allows TreeFilter implementations to cache state within
their instances during include(TreeWalk) if it is beneficial to
their implementation. Deep clones created by clone() may be used to
construct a thread-safe copy of an existing filter.
Path filters:
org.eclipse.jgit.treewalk.filter.PathFilter Difference filters:
ANY_DIFF.Boolean modifiers:
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| public static final TreeFilter | ALL
Selects all tree entries. |
| public static final TreeFilter | ANY_DIFF
Selects only tree entries which differ between at least 2 trees. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public abstract TreeFilter | |
| public Optional | Returns: a set of paths, or emptyIf this filter checks that at least one of the paths in a set has been modified, returns that set of paths to be checked against a changed path filter. |
| public abstract boolean | |
| public int | Returns: -1 if the current entry is a parent of the filter but no exact match has been made; 0 if the current entry should be seen by the application; 1 if it should be hidden.the walker the filter needs to examine. walker)Determine if the current entry is a parent, a match, or no match. |
| public TreeFilter | Returns: a new filter that includes tree entries this filter rejects.Create a new filter that does the opposite of this filter. |
| public abstract boolean | Returns: true if the filter would like to have the walker recurse into subtrees to make sure it matches everything correctly; false if the filter does not require entering subtrees.Does this tree filter require a recursive walk to match everything? |
| public String |
| ALL | back to summary |
|---|---|
| public static final TreeFilter ALL Selects all tree entries. | |
| ANY_DIFF | back to summary |
|---|---|
| public static final TreeFilter ANY_DIFF Selects only tree entries which differ between at least 2 trees. This filter also prevents a TreeWalk from recursing into a subtree if all parent trees have the identical subtree at the same path. This dramatically improves walk performance as only the changed subtrees are entered into.
If this filter is applied to a walker with only one tree it behaves like
When comparing | |
| TreeFilter | back to summary |
|---|---|
| public TreeFilter() | |
| clone | back to summary |
|---|---|
| public abstract TreeFilter clone() Overrides java. Doc from java. Creates and returns a copy of this object. The precise meaning
of "copy" may depend on the class of the object. The general
intent is that, for any object will be true, and that the expression:x.clone() != x will bex.clone().getClass() == x.getClass() true, but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x) true, this is not an absolute requirement.
By convention, the returned object should be obtained by calling
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by This is a deep clone. If this filter embeds objects or other filters it must also clone those, to ensure the instances do not share mutable data.
| |
| getPathsBestEffort | back to summary |
|---|---|
| public Optional If this filter checks that at least one of the paths in a set has been modified, returns that set of paths to be checked against a changed path filter. Otherwise, returns empty. | |
| include | back to summary |
|---|---|
| public abstract boolean include(TreeWalk walker) throws MissingObjectException, IncorrectObjectTypeException, IOException Determine if the current entry is interesting to report.
This method is consulted for subtree entries even if
| |
| matchFilter | back to summary |
|---|---|
| public int matchFilter(TreeWalk walker) throws MissingObjectException, IncorrectObjectTypeException, IOException Determine if the current entry is a parent, a match, or no match.
This method extends the result returned by
| |
| negate | back to summary |
|---|---|
| public TreeFilter negate() Create a new filter that does the opposite of this filter.
| |
| shouldBeRecursive | back to summary |
|---|---|
| public abstract boolean shouldBeRecursive() Does this tree filter require a recursive walk to match everything? If this tree filter is matching on full entry path names and its pattern is looking for a '/' then the filter would require a recursive TreeWalk to accurately make its decisions. The walker is not required to enable recursive behavior for any particular filter, this is only a hint.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public TreeFilter | clone()
Implements abstract org. Creates and returns a copy of this object. |
| public boolean | include(TreeWalk
the walker the filter needs to examine. walker)Implements abstract org. Determine if the current entry is interesting to report. |
| public boolean | shouldBeRecursive()
Implements abstract org. Does this tree filter require a recursive walk to match everything? |
| public String | toString()
Overrides org. Returns a string representation of the object. |
| AllFilter | back to summary |
|---|---|
| private AllFilter() | |
| clone | back to summary |
|---|---|
| public TreeFilter clone() Implements abstract org. Doc from org. Creates and returns a copy of this object. The precise meaning
of "copy" may depend on the class of the object. The general
intent is that, for any object will be true, and that the expression:x.clone() != x will bex.clone().getClass() == x.getClass() true, but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x) true, this is not an absolute requirement.
By convention, the returned object should be obtained by calling
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by This is a deep clone. If this filter embeds objects or other filters it must also clone those, to ensure the instances do not share mutable data.
| |
| include | back to summary |
|---|---|
| public boolean include(TreeWalk walker) Implements abstract org. Doc from org. Determine if the current entry is interesting to report.
This method is consulted for subtree entries even if
| |
| shouldBeRecursive | back to summary |
|---|---|
| public boolean shouldBeRecursive() Implements abstract org. Doc from org. Does this tree filter require a recursive walk to match everything? If this tree filter is matching on full entry path names and its pattern is looking for a '/' then the filter would require a recursive TreeWalk to accurately make its decisions. The walker is not required to enable recursive behavior for any particular filter, this is only a hint.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides org. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| Modifier and Type | Field and Description |
|---|---|
| private static final int |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public TreeFilter | clone()
Implements abstract org. Creates and returns a copy of this object. |
| public boolean | include(TreeWalk
the walker the filter needs to examine. walker)Implements abstract org. Determine if the current entry is interesting to report. |
| public boolean | shouldBeRecursive()
Implements abstract org. Does this tree filter require a recursive walk to match everything? |
| public String | toString()
Overrides org. Returns a string representation of the object. |
| baseTree | back to summary |
|---|---|
| private static final int baseTree | |
| AnyDiffFilter | back to summary |
|---|---|
| private AnyDiffFilter() | |
| clone | back to summary |
|---|---|
| public TreeFilter clone() Implements abstract org. Doc from org. Creates and returns a copy of this object. The precise meaning
of "copy" may depend on the class of the object. The general
intent is that, for any object will be true, and that the expression:x.clone() != x will bex.clone().getClass() == x.getClass() true, but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x) true, this is not an absolute requirement.
By convention, the returned object should be obtained by calling
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by This is a deep clone. If this filter embeds objects or other filters it must also clone those, to ensure the instances do not share mutable data.
| |
| include | back to summary |
|---|---|
| public boolean include(TreeWalk walker) Implements abstract org. Doc from org. Determine if the current entry is interesting to report.
This method is consulted for subtree entries even if
| |
| shouldBeRecursive | back to summary |
|---|---|
| public boolean shouldBeRecursive() Implements abstract org. Doc from org. Does this tree filter require a recursive walk to match everything? If this tree filter is matching on full entry path names and its pattern is looking for a '/' then the filter would require a recursive TreeWalk to accurately make its decisions. The walker is not required to enable recursive behavior for any particular filter, this is only a hint.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides org. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |