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 java.util.Collection;
23 import java.util.Map;
24
25 import org.eclipse.aether.graph.Dependency;
26 import org.eclipse.aether.graph.Exclusion;
27
28 /**
29 * The management updates to apply to a dependency.
30 *
31 * @see DependencyManager#manageDependency(Dependency)
32 */
33 public final class DependencyManagement
34 {
35
36 private String version;
37
38 private String scope;
39
40 private Boolean optional;
41
42 private Collection<Exclusion> exclusions;
43
44 private Map<String, String> properties;
45
46 /**
47 * Creates an empty management update.
48 */
49 public DependencyManagement()
50 {
51 // enables default constructor
52 }
53
54 /**
55 * Gets the new version to apply to the dependency.
56 *
57 * @return The new version or {@code null} if the version is not managed and the existing dependency version should
58 * remain unchanged.
59 */
60 public String getVersion()
61 {
62 return version;
63 }
64
65 /**
66 * Sets the new version to apply to the dependency.
67 *
68 * @param version The new version, may be {@code null} if the version is not managed.
69 * @return This management update for chaining, never {@code null}.
70 */
71 public DependencyManagement setVersion( String version )
72 {
73 this.version = version;
74 return this;
75 }
76
77 /**
78 * Gets the new scope to apply to the dependency.
79 *
80 * @return The new scope or {@code null} if the scope is not managed and the existing dependency scope should remain
81 * unchanged.
82 */
83 public String getScope()
84 {
85 return scope;
86 }
87
88 /**
89 * Sets the new scope to apply to the dependency.
90 *
91 * @param scope The new scope, may be {@code null} if the scope is not managed.
92 * @return This management update for chaining, never {@code null}.
93 */
94 public DependencyManagement setScope( String scope )
95 {
96 this.scope = scope;
97 return this;
98 }
99
100 /**
101 * Gets the new optional flag to apply to the dependency.
102 *
103 * @return The new optional flag or {@code null} if the flag is not managed and the existing optional flag of the
104 * dependency should remain unchanged.
105 */
106 public Boolean getOptional()
107 {
108 return optional;
109 }
110
111 /**
112 * Sets the new optional flag to apply to the dependency.
113 *
114 * @param optional The optional flag, may be {@code null} if the flag is not managed.
115 * @return This management update for chaining, never {@code null}.
116 */
117 public DependencyManagement setOptional( Boolean optional )
118 {
119 this.optional = optional;
120 return this;
121 }
122
123 /**
124 * Gets the new exclusions to apply to the dependency. Note that this collection denotes the complete set of
125 * exclusions for the dependency, i.e. the dependency manager controls whether any existing exclusions get merged
126 * with information from dependency management or overridden by it.
127 *
128 * @return The new exclusions or {@code null} if the exclusions are not managed and the existing dependency
129 * exclusions should remain unchanged.
130 */
131 public Collection<Exclusion> getExclusions()
132 {
133 return exclusions;
134 }
135
136 /**
137 * Sets the new exclusions to apply to the dependency. Note that this collection denotes the complete set of
138 * exclusions for the dependency, i.e. the dependency manager controls whether any existing exclusions get merged
139 * with information from dependency management or overridden by it.
140 *
141 * @param exclusions The new exclusions, may be {@code null} if the exclusions are not managed.
142 * @return This management update for chaining, never {@code null}.
143 */
144 public DependencyManagement setExclusions( Collection<Exclusion> exclusions )
145 {
146 this.exclusions = exclusions;
147 return this;
148 }
149
150 /**
151 * Gets the new properties to apply to the dependency. Note that this map denotes the complete set of properties,
152 * i.e. the dependency manager controls whether any existing properties get merged with the information from
153 * dependency management or overridden by it.
154 *
155 * @return The new artifact properties or {@code null} if the properties are not managed and the existing properties
156 * should remain unchanged.
157 */
158 public Map<String, String> getProperties()
159 {
160 return properties;
161 }
162
163 /**
164 * Sets the new properties to apply to the dependency. Note that this map denotes the complete set of properties,
165 * i.e. the dependency manager controls whether any existing properties get merged with the information from
166 * dependency management or overridden by it.
167 *
168 * @param properties The new artifact properties, may be {@code null} if the properties are not managed.
169 * @return This management update for chaining, never {@code null}.
170 */
171 public DependencyManagement setProperties( Map<String, String> properties )
172 {
173 this.properties = properties;
174 return this;
175 }
176
177 }