/** * get the variable list as an array * @return array of key=value assignment strings * @throws BuildException if any variable is misconfigured */ public String[] getVariables() throws BuildException { if (variables.isEmpty()) { return null; } return variables.stream().map(Variable::getContent).toArray(String[]::new); }
/** * Get the Attribute's value. * * @return the attribute's value. */ public String getValue() { return values.isEmpty() ? null : values.stream().collect(Collectors.joining(" ")); }
String vectorToList(Vector<String> v) { return v.stream().collect(Collectors.joining(", ")); }
/** * Tests whether or not the parent classloader should be checked for a * resource before this one. If the resource matches both the "use parent * classloader first" and the "use this classloader first" lists, the latter * takes priority. * * @param resourceName * The name of the resource to check. Must not be * <code>null</code>. * * @return whether or not the parent classloader should be checked for a * resource before this one is. */ private boolean isParentFirst(final String resourceName) { // default to the global setting and then see // if this class belongs to a package which has been // designated to use a specific loader first // (this one or the parent one) // TODO - shouldn't this always return false in isolated mode? return loaderPackages.stream().noneMatch(resourceName::startsWith) && (systemPackages.stream().anyMatch(resourceName::startsWith) || parentFirst); }
/** * Returns a stream to read the requested resource name from this loader. * * @param name The name of the resource for which a stream is required. * Must not be <code>null</code>. * * @return a stream to the required resource or <code>null</code> if * the resource cannot be found on the loader's classpath. */ private InputStream loadResource(final String name) { // we need to search the components of the path to see if we can // find the class we want. return pathComponents.stream().map(path -> getResourceStream(path, name)) .filter(Objects::nonNull).findFirst().orElse(null); }
/** * Check to see if the target is up to date with respect to input files. * @param files the list of files to check. * @return true if the cab file is newer than its dependents. */ protected boolean isUpToDate(Vector<String> files) { final long cabModified = cabFile.lastModified(); return files.stream().map(f -> FILE_UTILS.resolveFile(baseDir, f)) .mapToLong(File::lastModified).allMatch(t -> t < cabModified); }
/** * Names of the classes to process. * @return the array of classes. * @since Ant 1.6.3 */ public String[] getClasses() { Stream<String> stream = Stream.concat( files.stream() .map(fs -> fs.getDirectoryScanner(getProject()).getIncludedFiles()) .flatMap(Stream::of) .map(s -> s.replace('\\', '.').replace('/', '.') .replaceFirst("\\.class$", "")), classes.stream().map(ClassArgument::getName)); if (cls != null) { stream = Stream.concat(Stream.of(cls.split(",")).map(String::trim), stream); } return stream.toArray(String[]::new); }
/** * Find a ResourceLocation instance for the given publicId. * * @param publicId the publicId of the Resource for which local information * is required. * @return a ResourceLocation instance with information on the local location * of the Resource or null if no such information is available. */ private ResourceLocation findMatchingEntry(String publicId) { return getElements().stream() .filter(e -> e.getPublicId().equals(publicId)).findFirst() .orElse(null); }
private boolean hasAlreadyBeenImported(Resource importedResource, Vector<Object> importStack) { File importedFile = importedResource.asOptional(FileProvider.class) .map(FileProvider::getFile).orElse(null); URL importedURL = importedResource.asOptional(URLProvider.class) .map(URLProvider::getURL).orElse(null); return importStack.stream().anyMatch( o -> isOneOf(o, importedResource, importedFile, importedURL)); }
/** * Execute the specified sequence of targets, and the targets * they depend on. * * @param names A vector of target name strings to execute. * Must not be <code>null</code>. * * @exception BuildException if the build failed. */ public void executeTargets(final Vector<String> names) throws BuildException { setUserProperty(MagicNames.PROJECT_INVOKED_TARGETS, names.stream().collect(Collectors.joining(","))); getExecutor().executeTargets(this, names.toArray(new String[names.size()])); }
/** * Logs the compilation parameters, adds the files to compile and logs the * "niceSourceList" * @param jspc the compiler task for logging * @param compileList the list of files to compile * @param cmd the command line used */ protected void logAndAddFilesToCompile(JspC jspc, Vector<String> compileList, CommandlineJava cmd) { jspc.log("Compilation " + cmd.describeJavaCommand(), Project.MSG_VERBOSE); String niceSourceList = compileList.stream() .peek(arg -> cmd.createArgument().setValue(arg)) .map(arg -> String.format(" %s%n", arg)) .collect(Collectors.joining("")); jspc.log(String.format("File%s to be compiled:%n%s", compileList.size() == 1 ? "" : "s", niceSourceList), Project.MSG_VERBOSE); }
additionalBaseDirs.stream().map(File::getPath) .map(p -> new Path(null, p)).forEach(analyzer::addClassPath);
/** * Logs the compilation parameters, adds the files to compile and logs the * "niceSourceList" * @param cmd the commandline args */ protected void logAndAddFilesToCompile(Commandline cmd) { Vector<String> compileList = attributes.getCompileList(); attributes.log("Compilation " + cmd.describeArguments(), Project.MSG_VERBOSE); String niceSourceList = (compileList.size() == 1 ? "File" : "Files") + " to be compiled:" + compileList.stream().peek(arg -> cmd.createArgument().setValue(arg)) .collect(Collectors.joining(" ")); attributes.log(niceSourceList, Project.MSG_VERBOSE); }
filterChains.stream().map(FilterChain::getFilterReaders) .flatMap(Collection::stream).collect(Collectors.toList());
/** * Find out whether this Files collection has patterns. * * @return whether any patterns are in this container. */ public synchronized boolean hasPatterns() { if (isReference()) { return getRef().hasPatterns(); } dieOnCircularReference(); return hasPatterns(defaultPatterns) || additionalPatterns.stream().anyMatch(this::hasPatterns); }
boolean interrupted = false; TaskRunnable[] runnables = nestedTasks.stream().map(TaskRunnable::new) .toArray(TaskRunnable[]::new);
private void setProperties(final Project project) { project.init(); // resolve properties final PropertyHelper propertyHelper = PropertyHelper.getPropertyHelper(project); @SuppressWarnings({ "rawtypes", "unchecked" }) final Map raw = new HashMap(definedProps); @SuppressWarnings("unchecked") final Map<String, Object> props = raw; final ResolvePropertyMap resolver = new ResolvePropertyMap(project, NOPROPERTIES, propertyHelper.getExpanders()); resolver.resolveAllProperties(props, null, false); // set user-define properties props.forEach((arg, value) -> project.setUserProperty(arg, String.valueOf(value))); project.setUserProperty(MagicNames.ANT_FILE, buildFile.getAbsolutePath()); project.setUserProperty(MagicNames.ANT_FILE_TYPE, MagicNames.ANT_FILE_TYPE_FILE); // this list doesn't contain the build files default target, // which may be added later unless targets have been specified // on the command line. Therefore the property gets set again // in Project#executeTargets when we can be sure the list is // complete. // Setting it here allows top-level tasks to access the // property. project.setUserProperty(MagicNames.PROJECT_INVOKED_TARGETS, targets.stream().collect(Collectors.joining(","))); }
if (locals.stream().map(targetsMap::get) .filter(Objects::nonNull) .anyMatch(other -> other.dependsOn(owningTargetName))) {
@SuppressWarnings("unchecked") List<TogglableTreeNode> getAllChildren() { return (List<TogglableTreeNode>) children.stream() .map(child -> (TogglableTreeNode) child) .collect(Collectors.toList()); }
replyToList.stream().map(Object::toString).forEach(mailMessage::replyto);