Class ZPathImpl

  • All Implemented Interfaces:
    Resolvable, ZPath

    public class ZPathImpl
    extends java.lang.Object
    implements ZPath
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static ZPath root  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ZPath child​(java.lang.Object child)
      Return a ZPath that represents a child ZNode of this ZPath.
      boolean equals​(java.lang.Object o)  
      static ZPath from​(java.lang.String[] names)
      Convert individual path names into a ZPath.
      static ZPath from​(java.util.List<java.lang.String> names)
      Convert individual path names into a ZPath.
      static ZPath from​(ZPath base, java.lang.String[] names)
      Convert individual path names into a ZPath starting at the given base.
      static ZPath from​(ZPath base, java.util.List<java.lang.String> names)
      Convert individual path names into a ZPath starting at the given base.
      java.lang.String fullPath()
      The string full path that this ZPath represents
      int hashCode()  
      boolean isResolved()
      Return true if this path is fully resolved (i.e.
      boolean isRoot()
      Return true/false if this is the root ZPath
      java.lang.String nodeName()
      The node name at this ZPath
      ZPath parent()
      Return this ZPath's parent
      static ZPath parse​(java.lang.String fullPath, java.util.function.UnaryOperator<java.lang.String> nameFilter)
      Take a ZNode string path and return a ZPath
      ZPath resolved​(java.util.List<java.lang.Object> parameters)
      When creating paths, any node in the path can be set to ZPath.parameter().
      boolean startsWith​(ZPath path)
      Return true if this path starts with the given path.
      java.util.regex.Pattern toSchemaPathPattern()
      Return a regex Pattern useful for using in Schema
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.apache.curator.x.async.modeled.ZPath

        resolved
    • Field Detail

      • root

        public static final ZPath root
    • Method Detail

      • parse

        public static ZPath parse​(java.lang.String fullPath,
                                  java.util.function.UnaryOperator<java.lang.String> nameFilter)
        Description copied from interface: ZPath
        Take a ZNode string path and return a ZPath
        Parameters:
        fullPath - the path to parse
        nameFilter - each part of the path is passed through this filter
        Returns:
        ZPath
      • from

        public static ZPath from​(java.lang.String[] names)
        Description copied from interface: ZPath
        Convert individual path names into a ZPath. E.g. ZPath.from("my", "full", "path"). Any/all of the names can be passed as ZPath.parameter() so that the path can be resolved later using of the resolved() methods.
        Parameters:
        names - path names
        Returns:
        ZPath
      • from

        public static ZPath from​(java.util.List<java.lang.String> names)
        Description copied from interface: ZPath
        Convert individual path names into a ZPath. Any/all of the names can be passed as ZPath.parameter() so that the path can be resolved later using of the resolved() methods.
        Parameters:
        names - path names
        Returns:
        ZPath
      • from

        public static ZPath from​(ZPath base,
                                 java.lang.String[] names)
        Description copied from interface: ZPath
        Convert individual path names into a ZPath starting at the given base. E.g. if base is "/home/base" ZPath.from(base, "my", "full", "path") would be "/home/base/my/full/path". Any/all of the names can be passed as ZPath.parameter() so that the path can be resolved later using of the resolved() methods.
        Parameters:
        base - base/starting path
        names - path names
        Returns:
        ZPath
      • from

        public static ZPath from​(ZPath base,
                                 java.util.List<java.lang.String> names)
        Description copied from interface: ZPath
        Convert individual path names into a ZPath starting at the given base. Any/all of the names can be passed as ZPath.parameter() so that the path can be resolved later using of the resolved() methods.
        Parameters:
        base - base/starting path
        names - path names
        Returns:
        ZPath
      • child

        public ZPath child​(java.lang.Object child)
        Description copied from interface: ZPath

        Return a ZPath that represents a child ZNode of this ZPath. e.g. ZPath.from("a", "b").at("c") represents the path "/a/b/c"

        The replacement is the toString() value of child or, if it implements NodeName, the value of nodeName().

        Specified by:
        child in interface ZPath
        Parameters:
        child - child node name
        Returns:
        ZPath
      • parent

        public ZPath parent()
        Description copied from interface: ZPath
        Return this ZPath's parent
        Specified by:
        parent in interface ZPath
        Returns:
        parent ZPath
      • isRoot

        public boolean isRoot()
        Description copied from interface: ZPath
        Return true/false if this is the root ZPath
        Specified by:
        isRoot in interface ZPath
        Returns:
        true false
      • startsWith

        public boolean startsWith​(ZPath path)
        Description copied from interface: ZPath
        Return true if this path starts with the given path. i.e. ZPath.from("/one/two/three").startsWith(ZPath.from("/one/two")) returns true
        Specified by:
        startsWith in interface ZPath
        Parameters:
        path - base path
        Returns:
        true/false
      • toSchemaPathPattern

        public java.util.regex.Pattern toSchemaPathPattern()
        Description copied from interface: ZPath
        Return a regex Pattern useful for using in Schema
        Specified by:
        toSchemaPathPattern in interface ZPath
        Returns:
        pattern for this path
      • fullPath

        public java.lang.String fullPath()
        Description copied from interface: ZPath
        The string full path that this ZPath represents
        Specified by:
        fullPath in interface ZPath
        Returns:
        full path
      • nodeName

        public java.lang.String nodeName()
        Description copied from interface: ZPath
        The node name at this ZPath
        Specified by:
        nodeName in interface ZPath
        Returns:
        name
      • equals

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

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • resolved

        public ZPath resolved​(java.util.List<java.lang.Object> parameters)
        Description copied from interface: ZPath

        When creating paths, any node in the path can be set to ZPath.parameter(). At runtime, the ZPath can be "resolved" by replacing these nodes with values.

        The replacement is the toString() value of the parameter object or, if the object implements NodeName, the value of nodeName().

        Specified by:
        resolved in interface Resolvable
        Specified by:
        resolved in interface ZPath
        Parameters:
        parameters - list of replacements. Must have be the same length as the number of parameter nodes in the path
        Returns:
        new resolved ZPath
      • isResolved

        public boolean isResolved()
        Description copied from interface: ZPath
        Return true if this path is fully resolved (i.e. has no unresoled parameters)
        Specified by:
        isResolved in interface ZPath
        Returns:
        true/false