Package org.apache.lucene.tests.mockfile
Class FilterPath
- java.lang.Object
-
- org.apache.lucene.tests.mockfile.FilterPath
-
- All Implemented Interfaces:
Comparable<Path>,Iterable<Path>,Path,Watchable,Unwrappable<Path>
public class FilterPath extends Object implements Path, Unwrappable<Path>
AFilterPathcontains anotherPath, which it uses as its basic source of data, possibly transforming the data along the way or providing additional functionality.
-
-
Field Summary
Fields Modifier and Type Field Description protected PathdelegateThe underlyingPathinstance.protected FilterFileSystemfileSystemThe parentFileSystemfor this path.
-
Constructor Summary
Constructors Constructor Description FilterPath(Path delegate, FilterFileSystem fileSystem)Construct aFilterPathwith parentfileSystem, based on the specified base path.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Path other)booleanendsWith(String other)booleanendsWith(Path other)booleanequals(Object obj)PathgetDelegate()Get the underlying wrapped path.PathgetFileName()FileSystemgetFileSystem()PathgetName(int index)intgetNameCount()PathgetParent()PathgetRoot()inthashCode()booleanisAbsolute()Iterator<Path>iterator()Pathnormalize()WatchKeyregister(WatchService watcher, WatchEvent.Kind<?>... events)WatchKeyregister(WatchService watcher, WatchEvent.Kind<?>[] events, WatchEvent.Modifier... modifiers)Pathrelativize(Path other)Pathresolve(String other)Pathresolve(Path other)PathresolveSibling(String other)PathresolveSibling(Path other)booleanstartsWith(String other)booleanstartsWith(Path other)Pathsubpath(int beginIndex, int endIndex)PathtoAbsolutePath()protected PathtoDelegate(Path path)Override this to customize the unboxing of Path from various operationsFiletoFile()PathtoRealPath(LinkOption... options)StringtoString()URItoUri()Pathunwrap()static Pathunwrap(Path path)Unwraps allFilterPaths, returning the innermostPath.protected Pathwrap(Path other)-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
delegate
protected final Path delegate
The underlyingPathinstance.
-
fileSystem
protected final FilterFileSystem fileSystem
The parentFileSystemfor this path.
-
-
Constructor Detail
-
FilterPath
public FilterPath(Path delegate, FilterFileSystem fileSystem)
Construct aFilterPathwith parentfileSystem, based on the specified base path.- Parameters:
delegate- specified base path.fileSystem- parent fileSystem.
-
-
Method Detail
-
getDelegate
public Path getDelegate()
Get the underlying wrapped path.- Returns:
- wrapped path.
-
unwrap
public Path unwrap()
- Specified by:
unwrapin interfaceUnwrappable<Path>
-
getFileSystem
public FileSystem getFileSystem()
- Specified by:
getFileSystemin interfacePath
-
isAbsolute
public boolean isAbsolute()
- Specified by:
isAbsolutein interfacePath
-
getFileName
public Path getFileName()
- Specified by:
getFileNamein interfacePath
-
getNameCount
public int getNameCount()
- Specified by:
getNameCountin interfacePath
-
startsWith
public boolean startsWith(Path other)
- Specified by:
startsWithin interfacePath
-
startsWith
public final boolean startsWith(String other)
- Specified by:
startsWithin interfacePath
-
resolveSibling
public Path resolveSibling(Path other)
- Specified by:
resolveSiblingin interfacePath
-
resolveSibling
public final Path resolveSibling(String other)
- Specified by:
resolveSiblingin interfacePath
-
relativize
public Path relativize(Path other)
- Specified by:
relativizein interfacePath
-
toString
public String toString()
-
toAbsolutePath
public Path toAbsolutePath()
- Specified by:
toAbsolutePathin interfacePath
-
toRealPath
public Path toRealPath(LinkOption... options) throws IOException
- Specified by:
toRealPathin interfacePath- Throws:
IOException
-
register
public WatchKey register(WatchService watcher, WatchEvent.Kind<?>[] events, WatchEvent.Modifier... modifiers) throws IOException
- Specified by:
registerin interfacePath- Specified by:
registerin interfaceWatchable- Throws:
IOException
-
register
public WatchKey register(WatchService watcher, WatchEvent.Kind<?>... events) throws IOException
- Specified by:
registerin interfacePath- Specified by:
registerin interfaceWatchable- Throws:
IOException
-
compareTo
public int compareTo(Path other)
- Specified by:
compareToin interfaceComparable<Path>- Specified by:
compareToin interfacePath
-
hashCode
public int hashCode()
-
equals
public boolean equals(Object obj)
-
unwrap
public static Path unwrap(Path path)
Unwraps allFilterPaths, returning the innermostPath.WARNING: this is exposed for testing only!
- Parameters:
path- specified path.- Returns:
- innermost Path instance
-
-