Package org.opencms.util
Class CmsPath
java.lang.Object
org.opencms.util.CmsPath
- All Implemented Interfaces:
Serializable
,Comparable<CmsPath>
Simple data holder class which stores a path in a normalized form.
This is mostly useful when using paths as map keys, when you are not sure if the paths you are processing have a trailing slash or not.
The paths are stored in the form '/foo/bar/baz', i.e. they include a leading but no trailing slash, except in the case of the root path '/'.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionasString()
Gets the path as a string.int
boolean
int
hashCode()
boolean
isPrefixOf
(CmsPath path) Returns true if this path is a prefix of the path given as parameter.boolean
isPrefixOfStr
(String path) Returns true if this path is a prefix path of the given pathtoString()
-
Constructor Details
-
CmsPath
Creates a new instance.- Parameters:
pathStr
- the path string
-
-
Method Details
-
asString
Gets the path as a string.- Returns:
- the path as a string.
-
compareTo
- Specified by:
compareTo
in interfaceComparable<CmsPath>
- See Also:
-
equals
-
hashCode
-
isPrefixOf
Returns true if this path is a prefix of the path given as parameter.- Parameters:
path
- a path- Returns:
- true if this path is a prefix of the parameter
-
isPrefixOfStr
Returns true if this path is a prefix path of the given path- Parameters:
path
- a path- Returns:
- true if the path represented by this object is a prefix of the given path
-
toString
-