MCPcopy Index your code
hub / github.com/BruceEckel/OnJava8-Examples / main

Method main

onjava/atunit/ClassNameFinder.java:82–102  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

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:
105onjava.ArrayShow

Callers

nothing calls this directly

Calls 5

thisClassMethod · 0.95
walkMethod · 0.80
splitMethod · 0.80
containsMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected