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 what dependencies to include in the dependency graph. <em>Note:</em> For the sake of good performance during
15   * dependency collection, implementations should provide a semantic {@link Object#equals(Object) equals()} method.
16   * 
17   * @author Benjamin Bentmann
18   * @see org.sonatype.aether.RepositorySystemSession#getDependencySelector()
19   * @see org.sonatype.aether.RepositorySystem#collectDependencies(org.sonatype.aether.RepositorySystemSession,
20   *      CollectRequest)
21   */
22  public interface DependencySelector
23  {
24  
25      /**
26       * Applies exclusions to the specified dependency.
27       * 
28       * @param dependency The dependency to filter, must not be {@code null}.
29       * @return {@code false} if the dependency should be excluded from the children of the current node, {@code true}
30       *         otherwise.
31       */
32      boolean selectDependency( Dependency dependency );
33  
34      /**
35       * Derives a dependency selector for the specified collection context. When calculating the child selector,
36       * implementors are strongly advised to simply return the current instance if nothing changed to help save memory.
37       * 
38       * @param context The dependency collection context, must not be {@code null}.
39       * @return The dependency filter for the target node, must not be {@code null}.
40       */
41      DependencySelector deriveChildSelector( DependencyCollectionContext context );
42  
43  }