public final class PathPrefix extends Object
ClassPathEntry
and the rest of resource's abstract path. This concept
allows us to specify subsets of path hierarchies orthogonally from path
roots. For example, a path root might be /home/gwt/src/
and an
abstract path prefix might be module/client/
. Importantly,
you can apply the same abstract path prefix to multiple path roots and find
more than one set of resources residing in disjoint locations yet occupying
the same logical hierarchy. Sorry this explanation is so abstract; it's how
we model things like the GWT module's client source path, public path, and
super source path.Modifier and Type | Field and Description |
---|---|
static PathPrefix |
ALL |
Constructor and Description |
---|
PathPrefix(String prefix,
ResourceFilter filter)
Construct a non-rerooting prefix.
|
PathPrefix(String prefix,
ResourceFilter filter,
boolean shouldReroot)
Construct a prefix without global exclusions.
|
PathPrefix(String prefix,
ResourceFilter filter,
boolean shouldReroot,
String[] excludeList)
Construct a prefix.
|
Modifier and Type | Method and Description |
---|---|
boolean |
allows(String path)
Determines whether or not a given path is allowed by this path prefix by
checking both the prefix string and the filter.
|
boolean |
equals(Object obj)
Equality is based on prefixes representing the same string.
|
String |
getPrefix()
The prefix.
|
String |
getRerootedPath(String path) |
int |
hashCode() |
void |
merge(PathPrefix pathPrefix)
Consolidate a given
PathPrefix with this one, such that resources
excluded by neither prefix and included by either are allowed. |
boolean |
shouldReroot() |
String |
toString() |
public static final PathPrefix ALL
public PathPrefix(String prefix, ResourceFilter filter)
prefix
- a string prefix that (1) is the empty string or (2) begins
with something other than a slash and ends with a slashfilter
- the resource filter to use, or null
for no
filter; note that the filter must always return the same answer
for the same candidate path (doing otherwise will produce
inconsistent behavior in identifying available resources)public PathPrefix(String prefix, ResourceFilter filter, boolean shouldReroot)
prefix
- a string prefix that (1) is the empty string or (2) begins
with something other than a slash and ends with a slashfilter
- the resource filter to use, or null
for no
filter; note that the filter must always return the same answer
for the same candidate path (doing otherwise will produce
inconsistent behavior in identifying available resources)shouldReroot
- if true
, any matching Resource
for this prefix will be rerooted to not include the initial prefix
path; if false
, the prefix will be included in a
matching resource's path.public PathPrefix(String prefix, ResourceFilter filter, boolean shouldReroot, String[] excludeList)
prefix
- a string prefix that (1) is the empty string or (2) begins
with something other than a slash and ends with a slashfilter
- the resource filter to use, or null
for no
filter; note that the filter must always return the same answer
for the same candidate path (doing otherwise will produce
inconsistent behavior in identifying available resources)shouldReroot
- if true
, any matching Resource
for this prefix will be rerooted to not include the initial prefix
path; if false
, the prefix will be included in a
matching resource's path.excludeList
- list of globs that should be removed from any
module's resources.public boolean allows(String path)
path
- public boolean equals(Object obj)
public String getPrefix()
null
, and
either be the empty string or it will not begin with a slash and
will end with a slash; these guarantees are very useful when
concatenating paths that incorporate prefixespublic void merge(PathPrefix pathPrefix)
PathPrefix
with this one, such that resources
excluded by neither prefix and included by either are allowed.pathPrefix
- public boolean shouldReroot()
Copyright © 2018. All rights reserved.