@SuppressWarnings("SimplifiableIfStatement")
 protected boolean isListedOrDetectable(String name, boolean rootUrl) {
   // IMPL NOTE : protect the calls to getExplicitlyListedClassNames unless needed,
   // since it can take time with lots of listed classes.
   if (rootUrl) {
     // The entry comes from the root url.  Allow it if either:
     //		1) we are allowed to discover classes/packages in the root url
     //		2) the entry was explicitly listed
     return options.canDetectUnlistedClassesInRoot()
         || environment.getExplicitlyListedClassNames().contains(name);
   } else {
     // The entry comes from a non-root url.  Allow it if either:
     //		1) we are allowed to discover classes/packages in non-root urls
     //		2) the entry was explicitly listed
     return options.canDetectUnlistedClassesInNonRoot()
         || environment.getExplicitlyListedClassNames().contains(name);
   }
 }
  @SuppressWarnings("SimplifiableIfStatement")
  private boolean acceptAsMappingFile(
      MappingFileDescriptor mappingFileDescriptor, boolean rootUrl) {
    if (mappingFileDescriptor.getName().endsWith("hbm.xml")) {
      return options.canDetectHibernateMappingFiles();
    }

    if (mappingFileDescriptor.getName().endsWith("META-INF/orm.xml")) {
      if (environment.getExplicitlyListedMappingFiles().contains("META-INF/orm.xml")) {
        // if the user explicitly listed META-INF/orm.xml, only except the root one
        //
        // not sure why exactly, but this is what the old code does
        return rootUrl;
      }
      return true;
    }

    return environment.getExplicitlyListedMappingFiles().contains(mappingFileDescriptor.getName());
  }
  public ScanResultCollector(
      ScanEnvironment environment, ScanOptions options, ScanParameters parameters) {
    this.environment = environment;
    this.options = options;

    this.scanParameters = parameters;

    if (environment.getExplicitlyListedClassNames() == null) {
      throw new IllegalArgumentException(
          "ScanEnvironment#getExplicitlyListedClassNames should not return null");
    }

    if (environment.getExplicitlyListedMappingFiles() == null) {
      throw new IllegalArgumentException(
          "ScanEnvironment#getExplicitlyListedMappingFiles should not return null");
    }

    this.discoveredPackages = new HashSet<PackageDescriptor>();
    this.discoveredClasses = new HashSet<ClassDescriptor>();
    this.discoveredMappingFiles = new HashSet<MappingFileDescriptor>();
  }