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