boolean (@NotNull PackagingElement<?> element, @NotNull PackagingElementPath path) { boolean process = element instanceof CompositePackagingElement<?> packagingElement && firstName.equals(packagingElement.getName()) || element instanceof FileCopyPackagingElement fileCopy && firstName.equals(fileCopy.getOutputFileName()); if (process) { if (tail.length() == 0) { if (!processor.process(element, path)) return false; } else if (element instanceof CompositePackagingElement<?> packagingElement) { return processElementsByRelativePath(packagingElement, tail, context, artifactType, path, processor); } } return true; }