View Javadoc

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