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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasString()Gets the path as a string.intstatic booleanChecks if two (absolute) paths are equal in normalized form.booleaninthashCode()booleanisPrefixOf(CmsPath path) Returns true if this path is a prefix of the path given as parameter.booleanisPrefixOfStr(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
-
equal
Checks if two (absolute) paths are equal in normalized form.- Parameters:
path1- the first pathpath2- the second path- Returns:
- true if the paths are logically equal
-
asString
Gets the path as a string.- Returns:
- the path as a string.
-
compareTo
- Specified by:
compareToin 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
-