View Javadoc
1   package org.eclipse.aether.internal.impl.collect.bf;
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 java.util.List;
23  
24  import org.eclipse.aether.collection.DependencyManager;
25  import org.eclipse.aether.collection.DependencySelector;
26  import org.eclipse.aether.collection.DependencyTraverser;
27  import org.eclipse.aether.collection.VersionFilter;
28  import org.eclipse.aether.graph.Dependency;
29  import org.eclipse.aether.graph.DependencyNode;
30  import org.eclipse.aether.repository.RemoteRepository;
31  
32  /**
33   * Internal helper for {@link BfDependencyCollector}.
34   *
35   * @since 1.8.0
36   */
37  final class DependencyProcessingContext
38  {
39      final DependencySelector depSelector;
40      final DependencyManager depManager;
41      final DependencyTraverser depTraverser;
42      final VersionFilter verFilter;
43      final List<RemoteRepository> repositories;
44      final List<Dependency> managedDependencies;
45  
46      /**
47       * All parents of the dependency in the top > down order.
48       */
49      final List<DependencyNode> parents;
50      Dependency dependency;
51  
52      @SuppressWarnings( "checkstyle:parameternumber" )
53      DependencyProcessingContext( DependencySelector depSelector,
54                                   DependencyManager depManager,
55                                   DependencyTraverser depTraverser,
56                                   VersionFilter verFilter,
57                                   List<RemoteRepository> repositories,
58                                   List<Dependency> managedDependencies,
59                                   List<DependencyNode> parents,
60                                   Dependency dependency )
61      {
62          this.depSelector = depSelector;
63          this.depManager = depManager;
64          this.depTraverser = depTraverser;
65          this.verFilter = verFilter;
66          this.repositories = repositories;
67          this.dependency = dependency;
68          this.managedDependencies = managedDependencies;
69          this.parents = parents;
70      }
71  
72      DependencyProcessingContext withDependency( Dependency dependency )
73      {
74          this.dependency = dependency;
75          return this;
76      }
77  
78      DependencyNode getParent()
79      {
80          return parents.get( parents.size() - 1 );
81      }
82  }