blob: 47de2ee614b87a06c9ea76ab79b0531db91a8134 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
package ch.jodersky.sbt.jni.javah;
import java.nio.file.Path;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
public class ClassPath implements SearchPath {
private final Path path;
private final List<Path> roots;
public ClassPath(Path path) {
Objects.requireNonNull(path);
this.path = path.toAbsolutePath();
Path root = Utils.classPathRoot(path);
roots = root == null ? Collections.emptyList() : multiReleaseRoots(root);
}
@Override
public Path search(ClassName name) {
Objects.requireNonNull(name);
return searchFromRoots(roots, name);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ClassPath classPath = (ClassPath) o;
return Objects.equals(path, classPath.path);
}
@Override
public int hashCode() {
return path.hashCode();
}
@Override
public String toString() {
return "ClassPath[" + path + "]";
}
}
|