public final class PathFilters
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static PathFilter |
defaultImportFilter |
private static PathFilter |
defaultImportFilterWithServices |
private static PathFilter |
metaInfFilter |
private static PathFilter |
metaInfServicesFilter |
private static PathFilter |
metaInfSubdirectoriesFilter |
private static PathFilter |
metaInfSubdirectoriesWithoutMetaInfFilter |
Modifier | Constructor and Description |
---|---|
private |
PathFilters() |
Modifier and Type | Method and Description |
---|---|
static PathFilter |
acceptAll()
Get a filter which always returns
true . |
static PathFilter |
all(java.util.Collection<PathFilter> filters)
Get a path filter which returns
true if all of the given filters return true . |
static PathFilter |
all(PathFilter... filters)
Get a path filter which returns
true if all of the given filters return true . |
static PathFilter |
any(java.util.Collection<PathFilter> filters)
Get a path filter which returns
true if any of the given filters return true . |
static PathFilter |
any(PathFilter... filters)
Get a path filter which returns
true if any of the given filters return true . |
private static BooleanPathFilter |
booleanFilter(boolean val) |
static java.util.Iterator<Resource> |
filtered(PathFilter filter,
java.util.Iterator<Resource> original)
Get a filtered view of a resource iteration.
|
static PathFilter |
getDefaultImportFilter()
Get the default import path filter, which excludes all of
META-INF and its subdirectories. |
static PathFilter |
getDefaultImportFilterWithServices()
Get the default import-with-services path filter which excludes all of
META-INF and its subdirectories,
with the exception of META-INF/services . |
static PathFilter |
getMetaInfFilter()
Get a filter which matches the path
"META-INF" . |
static PathFilter |
getMetaInfServicesFilter()
Get a filter which matches the path
"META-INF/services" . |
static PathFilter |
getMetaInfSubdirectoriesFilter()
Get a filter which matches any subdirectory of the path
"META-INF" . |
static PathFilter |
getMetaInfSubdirectoriesWithoutMetaInfFilter()
Get a filter which matches all of
META-INF 's subdirectories, but not META-INF itself. |
static PathFilter |
in(java.util.Collection<java.lang.String> paths)
Get a filter which returns
true if the tested path is contained within the given collection. |
static PathFilter |
in(java.util.Set<java.lang.String> paths)
Get a filter which returns
true if the tested path is contained within the given set. |
static PathFilter |
is(java.lang.String path)
Get a path filter which matches an exact path name.
|
static PathFilter |
isChildOf(java.lang.String path)
Get a path filter which matches any path which is a child of the given path name (not including the
path name itself).
|
static PathFilter |
isOrIsChildOf(java.lang.String path)
Get a path filter which matches any path which is equal to, or a child of, the given path name.
|
static PathFilter |
match(java.lang.String glob)
Get a path filter which matches a glob.
|
static MultiplePathFilterBuilder |
multiplePathFilterBuilder(boolean defaultValue)
Get a builder for a multiple-path filter.
|
static PathFilter |
none(java.util.Collection<PathFilter> filters)
Get a path filter which returns
true if none of the given filters return true . |
static PathFilter |
none(PathFilter... filters)
Get a path filter which returns
true if none of the given filters return true . |
static PathFilter |
not(PathFilter filter)
Get a path filter which is
true when the given filter is false , and vice-versa. |
static PathFilter |
rejectAll()
Get a filter which always returns
false . |
private static final PathFilter defaultImportFilter
private static final PathFilter defaultImportFilterWithServices
private static final PathFilter metaInfFilter
private static final PathFilter metaInfSubdirectoriesFilter
private static final PathFilter metaInfServicesFilter
private static final PathFilter metaInfSubdirectoriesWithoutMetaInfFilter
public static PathFilter all(PathFilter... filters)
true
if all of the given filters return true
.filters
- the filterspublic static PathFilter all(java.util.Collection<PathFilter> filters)
true
if all of the given filters return true
.filters
- the filterspublic static PathFilter any(PathFilter... filters)
true
if any of the given filters return true
.filters
- the filterspublic static PathFilter any(java.util.Collection<PathFilter> filters)
true
if any of the given filters return true
.filters
- the filterspublic static PathFilter none(PathFilter... filters)
true
if none of the given filters return true
.filters
- the filterspublic static PathFilter none(java.util.Collection<PathFilter> filters)
true
if none of the given filters return true
.filters
- the filterspublic static PathFilter not(PathFilter filter)
true
when the given filter is false
, and vice-versa.filter
- the filterpublic static PathFilter match(java.lang.String glob)
/
" characters, which may include the special "*
" and "**
" segment strings
which match any directory and any number of nested directories, respectively.glob
- the globtrue
if the glob matchespublic static PathFilter is(java.lang.String path)
path
- the path nametrue
if the path name is an exact matchpublic static PathFilter isChildOf(java.lang.String path)
path
- the path nametrue
if the path name is a child of the given pathpublic static PathFilter isOrIsChildOf(java.lang.String path)
path
- the path nametrue
if the path name is equal to, or a child of, the given pathpublic static MultiplePathFilterBuilder multiplePathFilterBuilder(boolean defaultValue)
defaultValue
- the value to return if none of the nested filters matchprivate static BooleanPathFilter booleanFilter(boolean val)
public static PathFilter acceptAll()
true
.public static PathFilter rejectAll()
false
.public static PathFilter in(java.util.Set<java.lang.String> paths)
true
if the tested path is contained within the given set.
Each member of the set is a path separated by "/
" characters; null
s are disallowed.paths
- the path setpublic static PathFilter in(java.util.Collection<java.lang.String> paths)
true
if the tested path is contained within the given collection.
Each member of the collection is a path separated by "/
" characters; null
s are disallowed.paths
- the path collectionpublic static java.util.Iterator<Resource> filtered(PathFilter filter, java.util.Iterator<Resource> original)
filter
- the filter to checkoriginal
- the original iteratorpublic static PathFilter getDefaultImportFilter()
META-INF
and its subdirectories.public static PathFilter getDefaultImportFilterWithServices()
META-INF
and its subdirectories,
with the exception of META-INF/services
.public static PathFilter getMetaInfFilter()
"META-INF"
.public static PathFilter getMetaInfSubdirectoriesFilter()
"META-INF"
.public static PathFilter getMetaInfServicesFilter()
"META-INF/services"
.public static PathFilter getMetaInfSubdirectoriesWithoutMetaInfFilter()
META-INF
's subdirectories, but not META-INF
itself.