Class PathString

java.lang.Object
me.hsgamer.hscore.config.PathString
All Implemented Interfaces:
Comparable<PathString>

public class PathString extends Object implements Comparable<PathString>
The path string to use in Config
  • Field Details

  • Constructor Details

    • PathString

      public PathString(String... path)
      Create a new path string
      Parameters:
      path - the path
  • Method Details

    • toPath

      public static String toPath(String separator, PathString pathString)
      Join the path with the separator
      Parameters:
      separator - the separator
      pathString - the path string
      Returns:
      the joined path
    • toPathString

      public static PathString toPathString(String separator, String path)
      Split the path with the separator
      Parameters:
      separator - the separator
      path - the path
      Returns:
      the path string
    • toPathMap

      public static Map<String,Object> toPathMap(String separator, Map<PathString,Object> map)
      Join the path with the separator
      Parameters:
      separator - the separator
      map - the map containing the path string
      Returns:
      the map containing the joined path
    • toPathStringMap

      public static Map<PathString,Object> toPathStringMap(String separator, Map<String,Object> map)
      Split the path with the separator
      Parameters:
      separator - the separator
      map - the map containing the path
      Returns:
      the map containing the path string
    • toPath

      public static String toPath(PathString pathString)
      Join the path with the default separator
      Parameters:
      pathString - the path string
      Returns:
      the joined path
    • toPathString

      public static PathString toPathString(String path)
      Split the path with the default separator
      Parameters:
      path - the path
      Returns:
      the path string
    • toPathMap

      public static Map<String,Object> toPathMap(Map<PathString,Object> map)
      Join the path with the default separator
      Parameters:
      map - the map containing the path string
      Returns:
      the map containing the joined path
    • toPathStringMap

      public static Map<PathString,Object> toPathStringMap(Map<String,Object> map)
      Split the path with the default separator
      Parameters:
      map - the map containing the path
      Returns:
      the map containing the path string
    • getPath

      public String[] getPath()
      Get the path
      Returns:
      the path
    • getPathAsObject

      public Object[] getPathAsObject()
      Get the path as object array
      Returns:
      the path as object array
    • isRoot

      public boolean isRoot()
      Check if the path is empty. It means that the path is ROOT
      Returns:
      true if the path is empty
    • getLastPath

      public String getLastPath()
      Get the last path
      Returns:
      the last path
    • append

      public PathString append(PathString pathString)
      Create a new path string by appending the path string to the current path string
      Parameters:
      pathString - the path string to append
      Returns:
      the new path string
    • append

      public PathString append(String... path)
      Create a new path string by appending the path to the current path string
      Parameters:
      path - the path to append
      Returns:
      the new path string
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

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

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