Top Description Fields Constructors Methods
org.jboss.modules.filter

public final Class PathFilters

extends Object
Class Inheritance
Imports
java.util.Collection, .HashSet, .Iterator, .NoSuchElementException, .Set, org.jboss.modules.Resource

Static factory methods for path filter types.
Author
David M. Lloyd

Field Summary

Modifier and TypeField and Description
private static final PathFilter
private static final PathFilter
private static final PathFilter
private static final PathFilter
private static final PathFilter
private static final PathFilter

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static PathFilter

Returns:

the accept-all filter
acceptAll
()

Get a filter which always returns true.

public static PathFilter

Returns:

the "all" filter
all
(PathFilter...
the filters
filters
)

Get a path filter which returns true if all of the given filters return true.

public static PathFilter

Returns:

the "all" filter
all
(Collection<PathFilter>
the filters
filters
)

Get a path filter which returns true if all of the given filters return true.

public static PathFilter

Returns:

the "any" filter
any
(PathFilter...
the filters
filters
)

Get a path filter which returns true if any of the given filters return true.

public static PathFilter

Returns:

the "any" filter
any
(Collection<PathFilter>
the filters
filters
)

Get a path filter which returns true if any of the given filters return true.

private static BooleanPathFilter
booleanFilter(boolean val)

public static Iterator<Resource>

Returns:

the filtered iterator
filtered
(final PathFilter
the filter to check
filter
,
final Iterator<Resource>
the original iterator
original
)

Get a filtered view of a resource iteration.

public static PathFilter

Returns:

the default import path filter
getDefaultImportFilter
()

Get the default import path filter, which excludes all of META-INF and its subdirectories.

public static PathFilter

Returns:

the default import-with-services path filter
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.

public static PathFilter

Returns:

the filter
getMetaInfFilter
()

Get a filter which matches the path "META-INF".

public static PathFilter

Returns:

the filter
getMetaInfServicesFilter
()

Get a filter which matches the path "META-INF/services".

public static PathFilter

Returns:

the filter
getMetaInfSubdirectoriesFilter
()

Get a filter which matches any subdirectory of the path "META-INF".

public static PathFilter

Returns:

the filter
getMetaInfSubdirectoriesWithoutMetaInfFilter
()

Get a filter which matches all of META-INF's subdirectories, but not META-INF itself.

public static PathFilter

Returns:

the filter
in
(Set<String>
the path set
paths
)

Get a filter which returns true if the tested path is contained within the given set.

public static PathFilter

Returns:

the filter
in
(Collection<String>
the path collection
paths
)

Get a filter which returns true if the tested path is contained within the given collection.

public static PathFilter

Returns:

a filter which returns true if the path name is an exact match
is
(String
the path name
path
)

Get a path filter which matches an exact path name.

public static PathFilter

Returns:

a filter which returns true if the path name is a child of the given path
isChildOf
(String
the path name
path
)

Get a path filter which matches any path which is a child of the given path name (not including the path name itself).

public static PathFilter

Returns:

a filter which returns true if the path name is equal to, or a child of, the given path
isOrIsChildOf
(String
the path name
path
)

Get a path filter which matches any path which is equal to, or a child of, the given path name.

public static PathFilter

Returns:

a filter which returns true if the glob matches
match
(String
the glob
glob
)

Get a path filter which matches a glob.

public static MultiplePathFilterBuilder

Returns:

the builder
multiplePathFilterBuilder
(boolean
the value to return if none of the nested filters match
defaultValue
)

Get a builder for a multiple-path filter.

public static PathFilter

Returns:

the "none" filter
none
(PathFilter...
the filters
filters
)

Get a path filter which returns true if none of the given filters return true.

public static PathFilter

Returns:

the "none" filter
none
(Collection<PathFilter>
the filters
filters
)

Get a path filter which returns true if none of the given filters return true.

public static PathFilter

Returns:

the inverting filter
not
(PathFilter
the filter
filter
)

Get a path filter which is true when the given filter is false, and vice-versa.

public static PathFilter

Returns:

the reject-all filter
rejectAll
()

Get a filter which always returns false.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

defaultImportFilterback to summary
private static final PathFilter defaultImportFilter
defaultImportFilterWithServicesback to summary
private static final PathFilter defaultImportFilterWithServices
metaInfFilterback to summary
private static final PathFilter metaInfFilter
metaInfServicesFilterback to summary
private static final PathFilter metaInfServicesFilter
metaInfSubdirectoriesFilterback to summary
private static final PathFilter metaInfSubdirectoriesFilter
metaInfSubdirectoriesWithoutMetaInfFilterback to summary
private static final PathFilter metaInfSubdirectoriesWithoutMetaInfFilter

Constructor Detail

PathFiltersback to summary
private PathFilters()

Method Detail

acceptAllback to summary
public static PathFilter acceptAll()

Get a filter which always returns true.

Returns:PathFilter

the accept-all filter

allback to summary
public static PathFilter all(PathFilter... filters)

Get a path filter which returns true if all of the given filters return true.

Parameters
filters:PathFilter[]

the filters

Returns:PathFilter

the "all" filter

allback to summary
public static PathFilter all(Collection<PathFilter> filters)

Get a path filter which returns true if all of the given filters return true.

Parameters
filters:Collection<PathFilter>

the filters

Returns:PathFilter

the "all" filter

anyback to summary
public static PathFilter any(PathFilter... filters)

Get a path filter which returns true if any of the given filters return true.

Parameters
filters:PathFilter[]

the filters

Returns:PathFilter

the "any" filter

anyback to summary
public static PathFilter any(Collection<PathFilter> filters)

Get a path filter which returns true if any of the given filters return true.

Parameters
filters:Collection<PathFilter>

the filters

Returns:PathFilter

the "any" filter

booleanFilterback to summary
private static BooleanPathFilter booleanFilter(boolean val)
filteredback to summary
public static Iterator<Resource> filtered(final PathFilter filter, final Iterator<Resource> original)

Get a filtered view of a resource iteration. Only resources which pass the given filter are accepted.

Parameters
filter:PathFilter

the filter to check

original:Iterator<Resource>

the original iterator

Returns:Iterator<Resource>

the filtered iterator

getDefaultImportFilterback to summary
public static PathFilter getDefaultImportFilter()

Get the default import path filter, which excludes all of META-INF and its subdirectories.

Returns:PathFilter

the default import path filter

getDefaultImportFilterWithServicesback to summary
public 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.

Returns:PathFilter

the default import-with-services path filter

getMetaInfFilterback to summary
public static PathFilter getMetaInfFilter()

Get a filter which matches the path "META-INF".

Returns:PathFilter

the filter

getMetaInfServicesFilterback to summary
public static PathFilter getMetaInfServicesFilter()

Get a filter which matches the path "META-INF/services".

Returns:PathFilter

the filter

getMetaInfSubdirectoriesFilterback to summary
public static PathFilter getMetaInfSubdirectoriesFilter()

Get a filter which matches any subdirectory of the path "META-INF".

Returns:PathFilter

the filter

getMetaInfSubdirectoriesWithoutMetaInfFilterback to summary
public static PathFilter getMetaInfSubdirectoriesWithoutMetaInfFilter()

Get a filter which matches all of META-INF's subdirectories, but not META-INF itself.

Returns:PathFilter

the filter

inback to summary
public static PathFilter in(Set<String> paths)

Get a filter which returns true if the tested path is contained within the given set. Each member of the set is a path separated by "/" characters; nulls are disallowed.

Parameters
paths:Set<String>

the path set

Returns:PathFilter

the filter

inback to summary
public static PathFilter in(Collection<String> paths)

Get a filter which returns true if the tested path is contained within the given collection. Each member of the collection is a path separated by "/" characters; nulls are disallowed.

Parameters
paths:Collection<String>

the path collection

Returns:PathFilter

the filter

isback to summary
public static PathFilter is(String path)

Get a path filter which matches an exact path name.

Parameters
path:String

the path name

Returns:PathFilter

a filter which returns true if the path name is an exact match

isChildOfback to summary
public static PathFilter isChildOf(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).

Parameters
path:String

the path name

Returns:PathFilter

a filter which returns true if the path name is a child of the given path

isOrIsChildOfback to summary
public static PathFilter isOrIsChildOf(String path)

Get a path filter which matches any path which is equal to, or a child of, the given path name.

Parameters
path:String

the path name

Returns:PathFilter

a filter which returns true if the path name is equal to, or a child of, the given path

matchback to summary
public static PathFilter match(String glob)

Get a path filter which matches a glob. The given glob is a path separated by "/" characters, which may include the special "*" and "**" segment strings which match any directory and any number of nested directories, respectively.

Parameters
glob:String

the glob

Returns:PathFilter

a filter which returns true if the glob matches

multiplePathFilterBuilderback to summary
public static MultiplePathFilterBuilder multiplePathFilterBuilder(boolean defaultValue)

Get a builder for a multiple-path filter. Such a filter contains multiple filters, each associated with a flag which indicates that matching paths should be included or excluded.

Parameters
defaultValue:boolean

the value to return if none of the nested filters match

Returns:MultiplePathFilterBuilder

the builder

noneback to summary
public static PathFilter none(PathFilter... filters)

Get a path filter which returns true if none of the given filters return true.

Parameters
filters:PathFilter[]

the filters

Returns:PathFilter

the "none" filter

noneback to summary
public static PathFilter none(Collection<PathFilter> filters)

Get a path filter which returns true if none of the given filters return true.

Parameters
filters:Collection<PathFilter>

the filters

Returns:PathFilter

the "none" filter

notback to summary
public static PathFilter not(PathFilter filter)

Get a path filter which is true when the given filter is false, and vice-versa.

Parameters
filter:PathFilter

the filter

Returns:PathFilter

the inverting filter

rejectAllback to summary
public static PathFilter rejectAll()

Get a filter which always returns false.

Returns:PathFilter

the reject-all filter