1 package org.apache.maven.shared.dependency.graph;
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.apache.maven.artifact.Artifact;
25 import org.apache.maven.shared.dependency.graph.traversal.DependencyNodeVisitor;
26
27 /**
28 * Represents an artifact node within a Maven project's dependency graph.
29 *
30 * @author Hervé Boutemy
31 * @since 2.0
32 */
33 public interface DependencyNode
34 {
35 Artifact getArtifact();
36
37 List<DependencyNode> getChildren();
38
39 /**
40 * Applies the specified dependency node visitor to this dependency node and its children.
41 *
42 * @param visitor
43 * the dependency node visitor to use
44 * @return the visitor result of ending the visit to this node
45 * @since 1.1
46 */
47 boolean accept( DependencyNodeVisitor visitor );
48
49 /**
50 * Gets the parent dependency node of this dependency node.
51 *
52 * @return the parent dependency node
53 */
54 DependencyNode getParent();
55
56 /**
57 * Gets the version or version range for the dependency before dependency management was applied (if any).
58 *
59 * @return The dependency version before dependency management or {@code null} if the version was not managed.
60 */
61 String getPremanagedVersion();
62
63 /**
64 * Gets the scope for the dependency before dependency management was applied (if any).
65 *
66 * @return The dependency scope before dependency management or {@code null} if the scope was not managed.
67 */
68 String getPremanagedScope();
69
70 /**
71 * A constraint on versions for a dependency. A constraint can either consist of one or more version ranges or a
72 * single version.
73 *
74 * @return The constraint on the dependency.
75 */
76 String getVersionConstraint();
77
78 /**
79 * Returns a string representation of this dependency node.
80 *
81 * @return the string representation
82 */
83 String toNodeString();
84 }