Class CmsPath

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<CmsPath>

    public class CmsPath
    extends java.lang.Object
    implements java.io.Serializable, java.lang.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:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      CmsPath​(java.lang.String pathStr)
      Creates a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String asString()
      Gets the path as a string.
      int compareTo​(CmsPath o)  
      boolean equals​(java.lang.Object obj)  
      int hashCode()  
      boolean isPrefixOf​(CmsPath path)
      Returns true if this path is a prefix of the path given as parameter.
      boolean isPrefixOfStr​(java.lang.String path)
      Returns true if this path is a prefix path of the given path
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • CmsPath

        public CmsPath​(java.lang.String pathStr)
        Creates a new instance.
        Parameters:
        pathStr - the path string
    • Method Detail

      • asString

        public java.lang.String asString()
        Gets the path as a string.
        Returns:
        the path as a string.
      • compareTo

        public int compareTo​(CmsPath o)
        Specified by:
        compareTo in interface java.lang.Comparable<CmsPath>
        See Also:
        Comparable.compareTo(java.lang.Object)
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
        See Also:
        Object.equals(java.lang.Object)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
        See Also:
        Object.hashCode()
      • isPrefixOf

        public boolean isPrefixOf​(CmsPath path)
        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

        public boolean isPrefixOfStr​(java.lang.String path)
        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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        See Also:
        Object.toString()