code: private Method[] getAllMethods(Class<?> beanClass) {
          Map<String, Method> uniqueMethods = new HashMap<>();
          Class<?> currentClass = beanClass;
          while (currentClass != null && currentClass != Object.class) {
              addUniqueMethods(uniqueMethods, currentClass.getDeclaredMethods());
  
              // we also need to look for interface methods -
              // because the class may be abstract
              Class<?>[] interfaces = currentClass.getInterfaces();
              for (Class<?> anInterface : interfaces) {
                  addUniqueMethods(uniqueMethods, anInterface.getMethods());
              }
              currentClass = currentClass.getSuperclass();
          }
          Collection<Method> methods = uniqueMethods.values();
          return methods.toArray(new Method[0]);
      }
docs: This method returns an array containing all methods exposed in this
  class and any superclass. In the future, Java is not pleased to have
  access to private or protected methods.
  
  @param beanClass the class
  @return an array containing all the public methods in this class