1 package org.eclipse.aether.collection;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import org.eclipse.aether.RepositoryException;
23 import org.eclipse.aether.graph.DependencyNode;
24
25 /**
26 * Transforms a given dependency graph.
27 * <p>
28 * <strong>Note:</strong> Implementations must be stateless.
29 * <p>
30 * <em>Warning:</em> Dependency graphs may generally contain cycles. As such a graph transformer that cannot assume for
31 * sure that cycles have already been eliminated must gracefully handle cyclic graphs, e.g. guard against infinite
32 * recursion.
33 *
34 * @see org.eclipse.aether.RepositorySystemSession#getDependencyGraphTransformer()
35 */
36 public interface DependencyGraphTransformer
37 {
38
39 /**
40 * Transforms the dependency graph denoted by the specified root node. The transformer may directly change the
41 * provided input graph or create a new graph, the former is recommended for performance reasons.
42 *
43 * @param node The root node of the (possibly cyclic!) graph to transform, must not be {@code null}.
44 * @param context The graph transformation context, must not be {@code null}.
45 * @return The result graph of the transformation, never {@code null}.
46 * @throws RepositoryException If the transformation failed.
47 */
48 DependencyNode transformGraph( DependencyNode node, DependencyGraphTransformationContext context )
49 throws RepositoryException;
50
51 }