public class PathUtil
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
PathUtil.PathImpl |
| Modifier and Type | Field and Description |
|---|---|
static Path |
ROOT |
static java.lang.String |
SEPARATOR |
| Constructor and Description |
|---|
PathUtil() |
| Modifier and Type | Method and Description |
|---|---|
static PathSelector |
allpathSelector() |
static <T extends ContentMeta> |
allResourceSelector()
A resource selector which always matches
|
static Path |
appendPath(Path prefix,
java.lang.String subpath)
Append one path to another
|
static java.lang.String |
appendPath(java.lang.String prefixPath,
java.lang.String subpath)
Append one path to another
|
static Path |
asPath(java.lang.String path) |
static java.lang.String |
cleanPath(java.lang.String path)
Clean the path string by removing leading and trailing slashes and removing duplicate slashes.
|
static java.lang.String[] |
componentsFromPath(Path path) |
static java.lang.String[] |
componentsFromPathString(java.lang.String path) |
static <T extends ContentMeta> |
composeSelector(ResourceSelector<T> a,
ResourceSelector<T> b,
boolean and)
compose two selectors
|
static boolean |
equals(Path patha,
Path pathb) |
static <T extends ContentMeta> |
exactMetadataResourceSelector(java.util.Map<java.lang.String,java.lang.String> required,
boolean requireAll)
A resource selector which requires metadata values to be equal to some required strings
|
static boolean |
hasRoot(Path path,
Path root) |
static boolean |
hasRoot(java.lang.String path,
java.lang.String root) |
static boolean |
isRoot(Path path) |
static boolean |
isRoot(java.lang.String path) |
static Path |
parentPath(Path path) |
static java.lang.String |
parentPathString(java.lang.String path)
Return the string representing the parent of the given path
|
static Path |
pathFromComponents(java.lang.String[] components)
create a path from an array of components
|
static java.lang.String |
pathName(java.lang.String path) |
static java.lang.String |
pathStringFromComponents(java.lang.String[] components)
create a path from an array of components
|
static <T extends ContentMeta> |
regexMetadataResourceSelector(java.util.Map<java.lang.String,java.lang.String> required,
boolean requireAll)
A resource selector which requires metadata values to match regexes
|
static java.lang.String |
removePrefix(java.lang.String rootPath,
java.lang.String extpath) |
static <T extends ContentMeta> |
resourceSelector(java.lang.String selector)
Return a
ResourceSelector constructed using this selector syntax: |
static PathSelector |
subpathSelector(Path rootPath) |
public static final java.lang.String SEPARATOR
public static final Path ROOT
public static Path asPath(java.lang.String path)
public static Path pathFromComponents(java.lang.String[] components)
components - path components stringspublic static java.lang.String pathStringFromComponents(java.lang.String[] components)
components - path components stringspublic static java.lang.String[] componentsFromPath(Path path)
path - pathpublic static java.lang.String[] componentsFromPathString(java.lang.String path)
path - path stringpublic static boolean hasRoot(Path path, Path root)
path - test pathroot - rootpublic static boolean hasRoot(java.lang.String path,
java.lang.String root)
path - test pathroot - rootpublic static boolean isRoot(java.lang.String path)
path - path stringpublic static boolean isRoot(Path path)
path - pathpublic static boolean equals(Path patha, Path pathb)
patha - path Apathb - path Bpublic static java.lang.String parentPathString(java.lang.String path)
path - path stringpublic static java.lang.String cleanPath(java.lang.String path)
path - input pathpublic static java.lang.String pathName(java.lang.String path)
public static java.lang.String removePrefix(java.lang.String rootPath,
java.lang.String extpath)
public static Path appendPath(Path prefix, java.lang.String subpath)
prefix - prefixsubpath - sub pathpublic static java.lang.String appendPath(java.lang.String prefixPath,
java.lang.String subpath)
prefixPath - prefixsubpath - sub pathpublic static PathSelector subpathSelector(Path rootPath)
rootPath - path to matchpublic static PathSelector allpathSelector()
public static <T extends ContentMeta> ResourceSelector<T> exactMetadataResourceSelector(java.util.Map<java.lang.String,java.lang.String> required, boolean requireAll)
T - content typerequired - required metadata stringsrequireAll - if true, require all values are equal, otherwise require one value to be equalpublic static <T extends ContentMeta> ResourceSelector<T> regexMetadataResourceSelector(java.util.Map<java.lang.String,java.lang.String> required, boolean requireAll)
T - content typerequired - required metadata regexesrequireAll - if true, require all values match regexes, otherwise require one value to match the regexpublic static <T extends ContentMeta> ResourceSelector<T> composeSelector(ResourceSelector<T> a, ResourceSelector<T> b, boolean and)
T - resource typea - selector 1b - selector 2and - true indicates AND, otherwise ORpublic static <T extends ContentMeta> ResourceSelector<T> allResourceSelector()
T - content typepublic static <T extends ContentMeta> ResourceSelector<T> resourceSelector(java.lang.String selector)
ResourceSelector constructed using this selector syntax:key OP value [; key OP value]*OP can be "=" (exact match) or "=~" (regular expression match).
allResourceSelector()T - resource typeselector - the selector syntax string to parse, not null