1 package org.sonatype.aether.collection;
2
3 /*******************************************************************************
4 * Copyright (c) 2010-2011 Sonatype, Inc.
5 * All rights reserved. This program and the accompanying materials
6 * are made available under the terms of the Eclipse Public License v1.0
7 * which accompanies this distribution, and is available at
8 * http://www.eclipse.org/legal/epl-v10.html
9 *******************************************************************************/
10
11 import java.util.Collection;
12 import java.util.Map;
13
14 import org.sonatype.aether.graph.Dependency;
15 import org.sonatype.aether.graph.Exclusion;
16
17 /**
18 * The management updates to apply to a dependency.
19 *
20 * @author Benjamin Bentmann
21 * @see DependencyManager#manageDependency(Dependency)
22 */
23 public class DependencyManagement
24 {
25
26 private String version;
27
28 private String scope;
29
30 private Collection<Exclusion> exclusions;
31
32 private Map<String, String> properties;
33
34 /**
35 * Creates an empty management update.
36 */
37 public DependencyManagement()
38 {
39 // enables default constructor
40 }
41
42 /**
43 * Gets the new version to apply to the dependency.
44 *
45 * @return The new version or {@code null} if the version is not managed and the existing dependency version should
46 * remain unchanged.
47 */
48 public String getVersion()
49 {
50 return version;
51 }
52
53 /**
54 * Sets the new version to apply to the dependency.
55 *
56 * @param version The new version, may be {@code null} if the version is not managed.
57 * @return This management update for chaining, never {@code null}.
58 */
59 public DependencyManagement setVersion( String version )
60 {
61 this.version = version;
62 return this;
63 }
64
65 /**
66 * Gets the new scope to apply to the dependency.
67 *
68 * @return The new scope or {@code null} if the scope is not managed and the existing dependency scope should remain
69 * unchanged.
70 */
71 public String getScope()
72 {
73 return scope;
74 }
75
76 /**
77 * Sets the new scope to apply to the dependency.
78 *
79 * @param scope The new scope, may be {@code null} if the scope is not managed.
80 * @return This management update for chaining, never {@code null}.
81 */
82 public DependencyManagement setScope( String scope )
83 {
84 this.scope = scope;
85 return this;
86 }
87
88 /**
89 * Gets the new exclusions to apply to the dependency. Note that this collection denotes the complete set of
90 * exclusions for the dependency, i.e. the dependency manager controls whether any existing exclusions get merged
91 * with information from dependency management or overridden by it.
92 *
93 * @return The new exclusions or {@code null} if the exclusions are not managed and the existing dependency
94 * exclusions should remain unchanged.
95 */
96 public Collection<Exclusion> getExclusions()
97 {
98 return exclusions;
99 }
100
101 /**
102 * Sets the new exclusions to apply to the dependency. Note that this collection denotes the complete set of
103 * exclusions for the dependency, i.e. the dependency manager controls whether any existing exclusions get merged
104 * with information from dependency management or overridden by it.
105 *
106 * @param exclusions The new exclusions, may be {@code null} if the exclusions are not managed.
107 * @return This management update for chaining, never {@code null}.
108 */
109 public DependencyManagement setExclusions( Collection<Exclusion> exclusions )
110 {
111 this.exclusions = exclusions;
112 return this;
113 }
114
115 /**
116 * Gets the new properties to apply to the dependency. Note that this map denotes the complete set of properties,
117 * i.e. the dependency manager controls whether any existing properties get merged with the information from
118 * dependency management or overridden by it.
119 *
120 * @return The new artifact properties or {@code null} if the properties are not managed and the existing properties
121 * should remain unchanged.
122 */
123 public Map<String, String> getProperties()
124 {
125 return properties;
126 }
127
128 /**
129 * Sets the new properties to apply to the dependency. Note that this map denotes the complete set of properties,
130 * i.e. the dependency manager controls whether any existing properties get merged with the information from
131 * dependency management or overridden by it.
132 *
133 * @param properties The new artifact properties, may be {@code null} if the properties are not managed.
134 * @return This management update for chaining, never {@code null}.
135 */
136 public DependencyManagement setProperties( Map<String, String> properties )
137 {
138 this.properties = properties;
139 return this;
140 }
141
142 }