MCPcopy Create free account
hub / github.com/cinit/TMoe / getShortClassName

Method getShortClassName

app/src/main/java/cc/ioctl/tmoe/util/Reflex.java:1190–1210  ·  view source on GitHub ↗
(Object obj)

Source from the content-addressed store, hash-verified

1188 }
1189
1190 @NonNull
1191 public static String getShortClassName(Object obj) {
1192 String name;
1193 if (obj == null) {
1194 return "null";
1195 }
1196 if (obj instanceof String) {
1197 name = ((String) obj).replace("/", ".");
1198 } else if (obj instanceof Class) {
1199 name = ((Class<?>) obj).getName();
1200 } else if (obj instanceof Field) {
1201 name = ((Field) obj).getType().getName();
1202 } else {
1203 name = obj.getClass().getName();
1204 }
1205 if (!name.contains(".")) {
1206 return name;
1207 }
1208 int p = name.lastIndexOf('.');
1209 return name.substring(p + 1);
1210 }
1211
1212 public static boolean isCallingFromMethod(@NonNull String methodName, int maxDepth) {
1213 if (TextUtils.isEmpty(methodName)) {

Callers 2

showMethod · 0.95

Calls 1

containsMethod · 0.80

Tested by

no test coverage detected