java.lang.Object
org.apache.sling.feature.cpconverter.shared.RepoPath
All Implemented Interfaces:
Comparable<RepoPath>

public class RepoPath extends Object implements Comparable<RepoPath>
A Repo Path represents a path in the repository, for example when used in a repoinit section.
See Also:
  • Constructor Details

    • RepoPath

      public RepoPath(@NotNull @NotNull String path)
      Construct a Repo Path from a string. The string should separate the path segments with forward slashes, e.g. /my/repo/path.
      Parameters:
      path - The string representation of the path. If the initial leading forward slash is missing it will be assumed to be there.
    • RepoPath

      public RepoPath(@NotNull @NotNull List<String> list)
      Construct a Repo Path from a List.
      Parameters:
      list - The list to create the repo path from. The list should not have any separators.
  • Method Details

    • compareTo

      public int compareTo(@NotNull @NotNull RepoPath o)
      Specified by:
      compareTo in interface Comparable<RepoPath>
    • getParent

      @Nullable public @Nullable RepoPath getParent()
      Get the parent path of the current path.
      Returns:
      The parent path, or null if we are at the root and there is no further parent.
    • getSegments

      @NotNull public @NotNull List<String> getSegments()
    • startsWith

      public boolean startsWith(@Nullable @Nullable RepoPath otherPath)
      Check is this path starts with the other path.
      Parameters:
      otherPath - The other path to check against.
      Returns:
      If it starts with the other path or not.
    • isRepositoryPath

      public boolean isRepositoryPath()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object