MCPcopy Create free account
hub / github.com/antlr/codebuff / getSimpleName

Method getSimpleName

output/java_guava/1.4.19/ClassPath.java:296–311  ·  view source on GitHub ↗

Returns the simple name of the underlying class as given in the source code. Behaves identically to Class#getSimpleName() but does not require the class to be loaded.

()

Source from the content-addressed store, hash-verified

294
295
296 public String getSimpleName() {
297 int lastDollarSign = className.lastIndexOf('$');
298 if (lastDollarSign != -1) {
299 String innerClassName = className.substring(lastDollarSign + 1);
300 // local and anonymous classes are prefixed with number (1,2,3...), anonymous classes are
301 // entirely numeric whereas local classes have the user supplied name as a suffix
302 return CharMatcher.digit().trimLeadingFrom(innerClassName);
303 }
304 String packageName = getPackageName();
305 if (packageName.isEmpty()) {
306 return className;
307 }
308
309 // Since this is a top level class, its simple name is always the part after package name.
310 return className.substring(packageName.length() + 1);
311 }
312
313 /**
314 * Returns the fully qualified name of the class.

Callers 8

toStringHelperMethod · 0.45
serviceNameMethod · 0.45
serviceNameMethod · 0.45
toStringMethod · 0.45
getLockNameMethod · 0.45
expectArgumentMethod · 0.45
serviceNameMethod · 0.45
toStringHelperMethod · 0.45

Calls 6

digitMethod · 0.95
getPackageNameMethod · 0.95
isEmptyMethod · 0.65
lastIndexOfMethod · 0.45
trimLeadingFromMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected