| 1 | |
package org.webslinger.commons.vfs; |
| 2 | |
|
| 3 | |
import org.apache.commons.vfs.FileObject; |
| 4 | |
import org.apache.commons.vfs.FileName; |
| 5 | |
import org.apache.commons.vfs.FileSystem; |
| 6 | |
|
| 7 | |
public final class FileSystemAndNameKey { |
| 8 | |
protected final FileSystem fs; |
| 9 | |
protected final FileName name; |
| 10 | |
|
| 11 | |
public FileSystemAndNameKey(FileObject file) { |
| 12 | 0 | this(file.getFileSystem(), file.getName()); |
| 13 | 0 | } |
| 14 | |
|
| 15 | 0 | public FileSystemAndNameKey(FileSystem fs, FileName name) { |
| 16 | 0 | this.fs = fs; |
| 17 | 0 | this.name = name; |
| 18 | 0 | } |
| 19 | |
|
| 20 | |
public FileSystem getFileSystem() { |
| 21 | 0 | return fs; |
| 22 | |
} |
| 23 | |
|
| 24 | |
public FileName getName() { |
| 25 | 0 | return name; |
| 26 | |
} |
| 27 | |
|
| 28 | |
public boolean equals(Object o) { |
| 29 | 0 | if (!(o instanceof FileSystemAndNameKey)) return false; |
| 30 | 0 | FileSystemAndNameKey other = (FileSystemAndNameKey) o; |
| 31 | 0 | return fs == other.fs && name.equals(other.name); |
| 32 | |
} |
| 33 | |
|
| 34 | |
public int hashCode() { |
| 35 | 0 | return fs.hashCode() ^ name.hashCode(); |
| 36 | |
} |
| 37 | |
|
| 38 | |
public String toString() { |
| 39 | 0 | return "FSNK(" + getFileSystem() + ":" + getName() + ")"; |
| 40 | |
} |
| 41 | |
} |
| 42 | |
|