001package org.eclipse.aether.collection; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import org.eclipse.aether.graph.Dependency; 023 024/** 025 * Decides whether the dependencies of a dependency node should be traversed as well. 026 * <p> 027 * <strong>Note:</strong> Implementations must be stateless. 028 * <p> 029 * <em>Warning:</em> This hook is called from a hot spot and therefore implementations should pay attention to 030 * performance. Among others, implementations should provide a semantic {@link Object#equals(Object) equals()} method. 031 * 032 * @see org.eclipse.aether.RepositorySystemSession#getDependencyTraverser() 033 * @see org.eclipse.aether.RepositorySystem#collectDependencies(org.eclipse.aether.RepositorySystemSession, 034 * CollectRequest) 035 */ 036public interface DependencyTraverser 037{ 038 039 /** 040 * Decides whether the dependencies of the specified dependency should be traversed. 041 * 042 * @param dependency The dependency to check, must not be {@code null}. 043 * @return {@code true} if the dependency graph builder should recurse into the specified dependency and process its 044 * dependencies, {@code false} otherwise. 045 */ 046 boolean traverseDependency( Dependency dependency ); 047 048 /** 049 * Derives a dependency traverser that will be used to decide whether the transitive dependencies of the dependency 050 * given in the collection context shall be traversed. When calculating the child traverser, implementors are 051 * strongly advised to simply return the current instance if nothing changed to help save memory. 052 * 053 * @param context The dependency collection context, must not be {@code null}. 054 * @return The dependency traverser for the target node or {@code null} if dependencies should be unconditionally 055 * traversed in the sub graph. 056 */ 057 DependencyTraverser deriveChildTraverser( DependencyCollectionContext context ); 058 059}