@Test @DisplayName("Does not throw an error when collecting methods from java.lang.Object") public void collectsAllMethodsFromJavaLangObject() { Assertions.assertDoesNotThrow(() -> GeciReflectionTools.getAllMethodsSorted(java.lang.Object.class)); }
public static Method[] getAllMethodsSorted(final Class<?> klass) { final var allMethods = new ArrayList<>(Arrays.asList(klass.getDeclaredMethods())); var samePackage = true; for (var currentClass = klass.getSuperclass(); currentClass != null; currentClass = currentClass.getSuperclass()) { samePackage = samePackage && klass.getPackage() == currentClass.getPackage(); collectMethods(samePackage, currentClass, allMethods); } final Method[] methodArray = allMethods.toArray(new Method[0]); Arrays.sort(methodArray, Comparator.comparing(MethodTool::methodSignature)); return methodArray; }
GeciReflectionTools { public static Method[] getAllMethodsSorted(final Class<?> klass) { final var allMethods = new ArrayList<>(Arrays.asList(klass.getDeclaredMethods())); var samePackage = true; for (var currentClass = klass.getSuperclass(); currentClass != null; currentClass = currentClass.getSuperclass()) { samePackage = samePackage && klass.getPackage() == currentClass.getPackage(); collectMethods(samePackage, currentClass, allMethods); } final Method[] methodArray = allMethods.toArray(new Method[0]); Arrays.sort(methodArray, Comparator.comparing(MethodTool::methodSignature)); return methodArray; } }
GeciReflectionTools { public static Method[] getAllMethodsSorted(final Class<?> klass) { final var allMethods = new ArrayList<>(Arrays.asList(klass.getDeclaredMethods())); var samePackage = true; for (var currentClass = klass.getSuperclass(); currentClass != null; currentClass = currentClass.getSuperclass()) { samePackage = samePackage && klass.getPackage() == currentClass.getPackage(); collectMethods(samePackage, currentClass, allMethods); } final Method[] methodArray = allMethods.toArray(new Method[0]); Arrays.sort(methodArray, Comparator.comparing(MethodTool::methodSignature)); return methodArray; }  }
GeciReflectionTools { public static Method[] getAllMethodsSorted(final Class<?> klass) { final var allMethods = new ArrayList<>(Arrays.asList(klass.getDeclaredMethods())); var samePackage = true; for (var currentClass = klass.getSuperclass(); currentClass != null; currentClass = currentClass.getSuperclass()) { samePackage = samePackage && klass.getPackage() == currentClass.getPackage(); collectMethods(samePackage, currentClass, allMethods); } final Method[] methodArray = allMethods.toArray(new Method[0]); Arrays.sort(methodArray, Comparator.comparing(MethodTool::methodSignature)); return methodArray; }  static CompoundParams getParameters(AnnotatedElement element, String generatorMnemonic); static Invoker invoke(String methodName); static String modifiersString(Method method); static String modifiersStringNoAccess(Method method); static String typeAsString(Member member); static String normalizeTypeName(String s); static String normalizeTypeName(String s, Class<?> klass); static String getGenericTypeName(Type t); static String getSimpleGenericClassName(Class<?> t); static String getLocalGenericClassName(Class<?> t); static Field[] getDeclaredFieldsSorted(Class<?> klass); static Field[] getAllFieldsSorted(Class<?> klass); static Method[] getDeclaredMethodsSorted(Class<?> klass); static Method[] getMethodsSorted(Class<?> klass); static Method[] getAllMethodsSorted(final Class<?> klass); static Class[] getAllClassesSorted(Class<?> klass); static Class[] getDeclaredClassesSorted(Class<?> klass); static Class[] getClassesSorted(Class<?> klass); static Method getMethod(Class<?> klass, String methodName, Class<?>... classes); static Field getField(Class<?> klass, String fieldName); static Class<?> classForName(String className); static String unmask(int modifiers); static int mask(String masks, int dfault); }
GeciReflectionTools { public static Method[] getAllMethodsSorted(final Class<?> klass) { final var allMethods = new ArrayList<>(Arrays.asList(klass.getDeclaredMethods())); var samePackage = true; for (var currentClass = klass.getSuperclass(); currentClass != null; currentClass = currentClass.getSuperclass()) { samePackage = samePackage && klass.getPackage() == currentClass.getPackage(); collectMethods(samePackage, currentClass, allMethods); } final Method[] methodArray = allMethods.toArray(new Method[0]); Arrays.sort(methodArray, Comparator.comparing(MethodTool::methodSignature)); return methodArray; }  static CompoundParams getParameters(AnnotatedElement element, String generatorMnemonic); static Invoker invoke(String methodName); static String modifiersString(Method method); static String modifiersStringNoAccess(Method method); static String typeAsString(Member member); static String normalizeTypeName(String s); static String normalizeTypeName(String s, Class<?> klass); static String getGenericTypeName(Type t); static String getSimpleGenericClassName(Class<?> t); static String getLocalGenericClassName(Class<?> t); static Field[] getDeclaredFieldsSorted(Class<?> klass); static Field[] getAllFieldsSorted(Class<?> klass); static Method[] getDeclaredMethodsSorted(Class<?> klass); static Method[] getMethodsSorted(Class<?> klass); static Method[] getAllMethodsSorted(final Class<?> klass); static Class[] getAllClassesSorted(Class<?> klass); static Class[] getDeclaredClassesSorted(Class<?> klass); static Class[] getClassesSorted(Class<?> klass); static Method getMethod(Class<?> klass, String methodName, Class<?>... classes); static Field getField(Class<?> klass, String fieldName); static Class<?> classForName(String className); static String unmask(int modifiers); static int mask(String masks, int dfault); static final int PACKAGE; }