| 80 | } |
| 81 | // Demonstration: |
| 82 | public static void |
| 83 | main(String[] args) throws Exception { |
| 84 | PathMatcher matcher = FileSystems.getDefault() |
| 85 | .getPathMatcher("glob:**/*.class"); |
| 86 | // Walk the entire tree: |
| 87 | Files.walk(Paths.get(".")) |
| 88 | .filter(matcher::matches) |
| 89 | .map(p -> { |
| 90 | try { |
| 91 | return thisClass(Files.readAllBytes(p)); |
| 92 | } catch(Exception e) { |
| 93 | throw new RuntimeException(e); |
| 94 | } |
| 95 | }) |
| 96 | .filter(s -> s.startsWith("public:")) |
| 97 | // .filter(s -> s.indexOf('$') >= 0) |
| 98 | .map(s -> s.split(":")[1]) |
| 99 | .filter(s -> !s.startsWith("enums.")) |
| 100 | .filter(s -> s.contains(".")) |
| 101 | .forEach(System.out::println); |
| 102 | } |
| 103 | } |
| 104 | /* Output: |
| 105 | onjava.ArrayShow |