code: private void scan(final String targetPath, final String basePackageName, final String relativePackageName,
                        final WildcardMatcher matcher, final SaveHandler saveHandler) {
          final File target = new File(targetPath);
          if (!target.exists()) {
              return;
          }
  
          target.listFiles(file -> {
              String fileName = file.getName();
              if (file.isDirectory()) {
                  String relativePackageName2;
                  if (relativePackageName == null) {
                      relativePackageName2 = fileName + ResourceUtils.REGULAR_FILE_SEPARATOR;
                  } else {
                      relativePackageName2 = relativePackageName + fileName + ResourceUtils.REGULAR_FILE_SEPARATOR;
                  }
  
                  String basePath2 = targetPath + fileName + ResourceUtils.REGULAR_FILE_SEPARATOR;
                  scan(basePath2, basePackageName, relativePackageName2, matcher, saveHandler);
              } else if (fileName.endsWith(ClassUtils.CLASS_FILE_SUFFIX)) {
                  String className;
                  if (relativePackageName != null) {
                      className = basePackageName + relativePackageName + fileName.substring(0, fileName.length() - ClassUtils.CLASS_FILE_SUFFIX.length());
                  } else {
                      className = basePackageName + fileName.substring(0, fileName.length() - ClassUtils.CLASS_FILE_SUFFIX.length());
                  }
  
                  String relativePath = className.substring(basePackageName.length());
                  if (matcher.matches(relativePath)) {
                      String resourceName = targetPath + fileName;
                      Class<?> targetClass = loadClass(className);
                      saveHandler.save(resourceName, targetClass);
                  }
              }
              return false;
          });
      }
docs: Recursive method used to find all classes in a given directory and sub dirs.
  
  @param targetPath the target path
  @param basePackageName the base package name
  @param relativePackageName the relative package name
  @param matcher the matcher
  @param saveHandler the save handler