private Collection<? extends String> toStringList(List<SpoonFile> files) { List<String> res = new ArrayList<String>(); for (SpoonFile f : files) { if (f.isActualFile()) { res.add(f.toString()); } else { try { File file = File.createTempFile(f.getName(), ".java"); file.deleteOnExit(); IOUtils.copy(f.getContent(), new FileOutputStream(file)); res.add(file.toString()); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } } } return res; }
public T sources(List<SpoonFile> sources) { if (sources == null || sources.size() == 0) { args.add("."); return myself; } for (SpoonFile source : sources) { if (source.isActualFile()) { args.add(source.toString()); } else { try { File file = File.createTempFile(source.getName(), ".java"); file.deleteOnExit(); IOUtils.copy(source.getContent(), new FileOutputStream(file)); args.add(file.toString()); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } } } return myself; }