コード例 #1
0
  public void getClassesInPackage(
      LibraryInfo info, List<ClassFile> addTo, String[] pkgs, boolean inPkg) {

    PackageMapNode map = this;

    for (int i = 0; i < pkgs.length; i++) {
      map = map.subpackages.get(pkgs[i]);
      if (map == null) {
        return;
      }
    }

    try {

      info.bulkClassFileCreationStart();
      try {

        for (Map.Entry<String, ClassFile> entry : map.classFiles.entrySet()) {

          ClassFile cf = entry.getValue();
          if (cf == null) {
            StringBuilder name = new StringBuilder(pkgs[0]);
            for (int j = 1; j < pkgs.length; j++) {
              name.append('/').append(pkgs[j]);
            }
            name.append('/');
            name.append(entry.getKey()).append(".class");
            cf = info.createClassFileBulk(name.toString());
            map.classFiles.put(entry.getKey(), cf);
            possiblyAddTo(addTo, cf, inPkg);
          } else {
            possiblyAddTo(addTo, cf, inPkg);
          }
        }

      } finally {
        info.bulkClassFileCreationEnd();
      }

    } catch (IOException ioe) {
      ioe.printStackTrace();
    }
  }