/** {@inheritDoc}. */ public String[] mapFileName(String sourceFileName) { String[] result = getMappers().stream().filter(Objects::nonNull) .map(m -> m.mapFileName(sourceFileName)).filter(Objects::nonNull) .flatMap(Stream::of).toArray(String[]::new); return result.length == 0 ? null : result; } }
@Override public void setTo(String s) { fileNameMapper.setTo(s); }
@Override public void setFrom(String s) { fileNameMapper.setFrom(s); }
@Override public void setTo(String s) { fileNameMapper.setTo(s); }
@Override public void setFrom(String s) { fileNameMapper.setFrom(s); }
/** {@inheritDoc}. */ @Override public String[] mapFileName(String sourceFileName) { return getMappers().stream().filter(Objects::nonNull) .map(m -> m.mapFileName(sourceFileName)).filter(Objects::nonNull) .findFirst().orElse(null); }
final List<String> v = new ArrayList<>(); for (String name : names) { if (mapper.mapFileName(name) != null) { v.add(name); final String[] mappedFiles = mapper.mapFileName(name); if (mappedFiles == null || mappedFiles.length == 0) { continue;
private Collection<Resource> getCollection() { FileNameMapper m = mapper == null ? new IdentityMapper() : mapper.getImplementation(); Stream<MappedResource> stream; if (enableMultipleMappings) { stream = nested.stream() .flatMap(r -> Stream.of(m.mapFileName(r.getName())) .filter(Objects::nonNull) .map(MergingMapper::new) .map(mm -> new MappedResource(r, mm))); } else { stream = nested.stream().map(r -> new MappedResource(r, m)); } return stream.collect(Collectors.toList()); }
final List<Resource> v = new ArrayList<>(); for (Resource rc : fromResources) { if (mapper.mapFileName(rc.getName()) != null) { v.add(rc); final String[] mappedFiles = mapper.mapFileName(rc.getName()); if (mappedFiles == null || mappedFiles.length == 0) { throw new BuildException("Can't copy a resource without a"
/** * Maps the name. */ @Override public String getName() { String name = getResource().getName(); if (isReference()) { return name; } String[] mapped = mapper.mapFileName(name); return mapped != null && mapped.length > 0 ? mapped[0] : null; }
/** * The heart of the matter. This is where the selector gets to decide * on the inclusion of a file in a particular fileset. * * @param basedir the base directory the scan is being done from * @param filename is the name of the file to check * @param file is a java.io.File object the selector can use * @return whether the file should be selected or not */ @Override public boolean isSelected(File basedir, String filename, File file) { // throw BuildException on error validate(); // Determine file whose out-of-dateness is to be checked String[] destfiles = map.mapFileName(filename); // If filename does not match the To attribute of the mapper // then filter it out of the files we are considering if (destfiles == null) { return false; } // Sanity check if (destfiles.length != 1 || destfiles[0] == null) { throw new BuildException("Invalid destination file results for " + targetdir.getName() + " with filename " + filename); } String destname = destfiles[0]; File destfile = FILE_UTILS.resolveFile(targetdir, destname); return selectionTest(file, destfile); }
/** * The heart of the matter. This is where the selector gets to decide * on the inclusion of a file in a particular fileset. * * @param basedir the base directory the scan is being done from * @param filename is the name of the file to check * @param file is a java.io.File object the selector can use * @return whether the file should be selected or not */ @Override public boolean isSelected(final File basedir, final String filename, final File file) { // throw BuildException on error validate(); // Determine file whose existence is to be checked final String[] destfiles = map.mapFileName(filename); // If filename does not match the To attribute of the mapper // then filter it out of the files we are considering if (destfiles == null) { return false; } // Sanity check if (destfiles.length != 1 || destfiles[0] == null) { throw new BuildException("Invalid destination file results for " + targetdir + " with filename " + filename); } final String destname = destfiles[0]; final File destfile = FileUtils.getFileUtils().resolveFile(targetdir, destname); return destfile.exists() == destmustexist; }
String classFileName = classname.replace('.', File.separatorChar) + ".class"; String[] generatedFiles = adapter.getMapper().mapFileName(classFileName); if (generatedFiles == null) { return;
String[] toFiles = mapper.mapFileName(sourceFileName); if (toFiles == null) { continue;
Set<String> addedFiles = new HashSet<>(); for (String srcFile : srcFiles) { String[] subTargets = mapper.mapFileName(srcFile); if (subTargets != null) { for (String subTarget : subTargets) {
} else { final FileNameMapper mapper = mapperElement.getImplementation(); final String[] d = mapper.mapFileName(source.toString()); if (d == null) { log("skipping " + r + " - mapper can't handle it",
String[] mappedNames = mapper.mapFileName(entryName); if (mappedNames == null || mappedNames.length == 0) { mappedNames = new String[] {entryName};
FileNameMapper mapperImpl = mapper == null ? new IdentityMapper() : mapper.getImplementation(); for (Resource r : resources) { String[] mapped = mapperImpl.mapFileName(String.valueOf(r)); for (int m = 0; mapped != null && m < mapped.length; ++m) { ret.add(mapped[m]);
String[] newname = m.mapFileName(name); if (newname != null) { name = newname[0];