MCPcopy Index your code
hub / github.com/apache/groovy / shortName

Method shortName

src/main/java/groovy/inspect/Inspector.java:360–369  ·  view source on GitHub ↗

Returns the class name without its package prefix. @param clazz the class to shorten @return the shortened class name, or #NOT_APPLICABLE

(Class clazz)

Source from the content-addressed store, hash-verified

358 * @return the shortened class name, or {@link #NOT_APPLICABLE}
359 */
360 public static String shortName(Class clazz) {
361 if (null == clazz) return NOT_APPLICABLE;
362 String className = clazz.getName();
363 if (null == clazz.getPackage()) return className;
364 String packageName = clazz.getPackage().getName();
365 int offset = packageName.length();
366 if (offset > 0) offset++;
367 className = className.substring(offset);
368 return className;
369 }
370
371 private static String makeTypesInfo(Class[] types) {
372 StringBuilder sb = new StringBuilder(32);

Callers 5

getClassPropsMethod · 0.95
fieldInfoMethod · 0.95
fieldWithInfoMethod · 0.95
makeTypesInfoMethod · 0.95
methodInfoMethod · 0.95

Calls 4

substringMethod · 0.80
getNameMethod · 0.65
getPackageMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected