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