Class BasicPath

  • All Implemented Interfaces:
    java.lang.Comparable<ArchivePath>, ArchivePath

    public class BasicPath
    extends java.lang.Object
    implements ArchivePath, java.lang.Comparable<ArchivePath>
    A Path which may be optionally prefixed with some common namespace context at construction time. Thread-safe.
    Version:
    $Revision: $
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String context
      The context which this path represents; immutable so we're thread-safe.
      private static java.util.logging.Logger log
      Logger
    • Constructor Summary

      Constructors 
      Constructor Description
      BasicPath()
      Creates a new Path representing the root context
      BasicPath​(java.lang.String context)
      Creates a new Path with the specified context
      BasicPath​(java.lang.String basePath, java.lang.String context)
      Creates a new Path using the specified base and specified relative context.
      BasicPath​(java.lang.String basePath, ArchivePath context)
      Creates a new Path using the specified base and specified relative context.
      BasicPath​(ArchivePath basePath, java.lang.String context)
      Creates a new Path using the specified base and specified relative context.
      BasicPath​(ArchivePath basePath, ArchivePath context)
      Creates a new Path using the specified base and specified relative context.
    • Field Detail

      • log

        private static final java.util.logging.Logger log
        Logger
      • context

        private final java.lang.String context
        The context which this path represents; immutable so we're thread-safe.
    • Constructor Detail

      • BasicPath

        public BasicPath()
        Creates a new Path representing the root context
      • BasicPath

        public BasicPath​(java.lang.String context)
        Creates a new Path with the specified context
        Parameters:
        context - The context which this path represents. Null or blank represents the root. Relative paths will be adjusted to absolute form.
      • BasicPath

        public BasicPath​(ArchivePath basePath,
                         ArchivePath context)
        Creates a new Path using the specified base and specified relative context.
        Parameters:
        basePath -
        context -
      • BasicPath

        public BasicPath​(ArchivePath basePath,
                         java.lang.String context)
        Creates a new Path using the specified base and specified relative context.
        Parameters:
        basePath -
        context -
      • BasicPath

        public BasicPath​(java.lang.String basePath,
                         ArchivePath context)
        Creates a new Path using the specified base and specified relative context.
        Parameters:
        basePath -
        context -
      • BasicPath

        public BasicPath​(java.lang.String basePath,
                         java.lang.String context)
        Creates a new Path using the specified base and specified relative context.
        Parameters:
        basePath -
        context -
    • Method Detail

      • getParent

        public ArchivePath getParent()
        Obtains the parent of this Path, if exists, else null. For instance if the Path is "/my/path", the parent will be "/my". Each call will result in a new object reference, though subsequent calls upon the same Path will be equal by value.
        Specified by:
        getParent in interface ArchivePath
        Returns:
        See Also:
        ArchivePath.getParent()
      • compareTo

        public int compareTo​(ArchivePath path)
        Specified by:
        compareTo in interface java.lang.Comparable<ArchivePath>
        See Also:
        Comparable.compareTo(java.lang.Object)
      • hashCode

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

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

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