de.zeigermann.xml.simpleImporter
Class SimplePath
Rudimentary representation of a path to an XML element.
Two paths match in two cases:
- If they are really equal in terms of the
equals(Object)
method.
- If the path to match to is relative, i.e. it has no leading '/' and it is the suffix of the matching path.
For example
/root/tag
matches
/root/tag
and
/root/tag
matches
tag
.
boolean | equals(Object o)
|
boolean | matches(String matchPath) - Finds out if the path represented by the given string matches this one.
|
boolean | matches(Item name) - Checks if an item matches the last segment of this path.
|
boolean | matches(Item[] path) - Checks if the given array of items matches this path.
|
boolean | matches(Item[] path, boolean isRelative) - Checks if the given array of items matches this path.
|
boolean | matches(SimplePath matchPath) - Finds out if the the given path matches this one.
|
boolean | matchesFromRoot(Item[] path) - Checks if the given array of items matches this path from the root.
|
boolean | matchsAny(Collection paths) - Checks if this path matches any of the paths stored in
paths collection.
|
boolean | matchsAny(String[] paths) - Checks if this path matches any of the paths stored in
paths collection.
|
static String | stripEndingSlash(String path) - Strips off ending slash from a string if there is one.
|
String | toString()
|
path
protected final String path
pathList
protected final Item[] pathList
SimplePath
public SimplePath(String path)
Creates a path object from a string describing it. The describing
string uses '/' characters to seperate the paths parts.
SimplePath
public SimplePath(String path,
Item[] pathList)
Creates a path object from a string describing it. The describing
string uses '/' characters to seperate the paths parts.
SimplePath
public SimplePath(SimplePath path)
Copy ctor.
equals
public boolean equals(Object o)
matches
public boolean matches(String matchPath)
Finds out if the path represented by the given string matches this one.
matches
public boolean matches(Item name)
Checks if an item matches the last segment of this path.
matches
public boolean matches(Item[] path)
Checks if the given array of items matches this path. The given path is to be considered relative.
matches
public boolean matches(Item[] path,
boolean isRelative)
Checks if the given array of items matches this path.
matches
public boolean matches(SimplePath matchPath)
Finds out if the the given path matches this one.
matchesFromRoot
public boolean matchesFromRoot(Item[] path)
Checks if the given array of items matches this path from the root. The given path is to be considered relative.
Useful to distinguish between something like /rootPath/valid/*\/valid and /rootPath/invalid/*\/valid. You will need two
matches for this:
matchesFromRoot(new Item[] { new Item("rootPath"), new Item("valid")})
&&
matches(new Item("valid"))
matchsAny
public boolean matchsAny(Collection paths)
Checks if this path matches any of the paths stored in
paths
collection. This means we iterate through
paths
and match every entry to this path.
matchsAny
public boolean matchsAny(String[] paths)
Checks if this path matches any of the paths stored in
paths
collection. This means we iterate through
paths
and match every entry to this path.
stripEndingSlash
public static final String stripEndingSlash(String path)
Strips off ending slash from a string if there is one.
toString
public String toString()
Copyright B) 2002-2004 Oliver Zeigermann. All Rights Reserved.