Skip to content

Commit

Permalink
Merge pull request #219 from shiyindaxiaojie/feature
Browse files Browse the repository at this point in the history
Feature
  • Loading branch information
shiyindaxiaojie authored Oct 25, 2024
2 parents 31c0fd0 + 2f4afae commit 8f57af8
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,25 @@ public static List<Method> getDeclaredMethods(@NonNull Class<?> clazz) {
return methodList;
}

public static String resolveMethodNameAndParams(@NonNull Method method) {
String className = method.getDeclaringClass().getName();
String name = method.getName();
Class<?>[] params = method.getParameterTypes();

StringBuilder sb = new StringBuilder();
sb.append(className).append(":").append(name);
sb.append("(");
int paramPos = 0;
for (Class<?> clazz : params) {
sb.append(clazz.getCanonicalName());
if (++paramPos < params.length) {
sb.append(",");
}
}
sb.append(")");
return sb.toString();
}

public static <T> Class<T> getSuperClassGenricType(@NonNull Class<?> clazz, final int index) {
Type genType = clazz.getGenericSuperclass();
if (!(genType instanceof ParameterizedType)) {
Expand Down

0 comments on commit 8f57af8

Please sign in to comment.