[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Parsing more than one file

alesj do-not-reply at jboss.com
Mon Mar 31 11:52:46 EDT 2008


"alesj" wrote : 
  | This one is no brainer. :-)
  | 
So it the second one. :-)
It just matches more files, due to additional suffix match.


  |    protected T parse(DeploymentUnit unit, Set<String> names, String suffix, T root) throws Exception
  |    {
  |       if (names == null || names.isEmpty())
  |          throw new IllegalArgumentException("Null or empty names.");
  | 
  |       VFSDeploymentUnit  vfsDeploymentUnit = (VFSDeploymentUnit)unit;
  | 
  |       Set<VirtualFile> files = new HashSet<VirtualFile>();
  |       Set<String> missingFiles = new HashSet<String>();
  | 
  |       for (String name : names)
  |       {
  |          List<VirtualFile> matched = vfsDeploymentUnit.getMetaDataFiles(name, suffix);
  |          if (matched != null && matched.isEmpty() == false)
  |             files.addAll(matched);
  |          else
  |             missingFiles.add(name);
  |       }
  | 
  |       if (missingFiles.size() == names.size())
  |          return null;
  | 
  |       return mergeFiles(files, missingFiles);
  |    }
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4140213#4140213

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4140213



More information about the jboss-dev-forums mailing list