1 /******************************************************************************* 2 * Copyright (c) 2010, 2014 Sonatype, Inc. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * Sonatype, Inc. - initial API and implementation 10 *******************************************************************************/ 11 package org.eclipse.aether.collection; 12 13 import org.eclipse.aether.graph.Dependency; 14 15 /** 16 * Decides whether the dependencies of a dependency node should be traversed as well. 17 * <p> 18 * <strong>Note:</strong> Implementations must be stateless. 19 * <p> 20 * <em>Warning:</em> This hook is called from a hot spot and therefore implementations should pay attention to 21 * performance. Among others, implementations should provide a semantic {@link Object#equals(Object) equals()} method. 22 * 23 * @see org.eclipse.aether.RepositorySystemSession#getDependencyTraverser() 24 * @see org.eclipse.aether.RepositorySystem#collectDependencies(org.eclipse.aether.RepositorySystemSession, 25 * CollectRequest) 26 */ 27 public interface DependencyTraverser 28 { 29 30 /** 31 * Decides whether the dependencies of the specified dependency should be traversed. 32 * 33 * @param dependency The dependency to check, must not be {@code null}. 34 * @return {@code true} if the dependency graph builder should recurse into the specified dependency and process its 35 * dependencies, {@code false} otherwise. 36 */ 37 boolean traverseDependency( Dependency dependency ); 38 39 /** 40 * Derives a dependency traverser that will be used to decide whether the transitive dependencies of the dependency 41 * given in the collection context shall be traversed. When calculating the child traverser, implementors are 42 * strongly advised to simply return the current instance if nothing changed to help save memory. 43 * 44 * @param context The dependency collection context, must not be {@code null}. 45 * @return The dependency traverser for the target node or {@code null} if dependencies should be unconditionally 46 * traversed in the sub graph. 47 */ 48 DependencyTraverser deriveChildTraverser( DependencyCollectionContext context ); 49 50 }