1 package org.eclipse.aether.deployment;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.util.ArrayList;
23 import java.util.Collection;
24 import java.util.Collections;
25 import static java.util.Objects.requireNonNull;
26
27 import org.eclipse.aether.RepositorySystem;
28 import org.eclipse.aether.RepositorySystemSession;
29 import org.eclipse.aether.artifact.Artifact;
30 import org.eclipse.aether.metadata.Metadata;
31
32
33
34
35
36
37 public final class DeployResult
38 {
39
40 private final DeployRequest request;
41
42 private Collection<Artifact> artifacts;
43
44 private Collection<Metadata> metadata;
45
46
47
48
49
50
51 public DeployResult( DeployRequest request )
52 {
53 this.request = requireNonNull( request, "deploy request cannot be null" );
54 artifacts = Collections.emptyList();
55 metadata = Collections.emptyList();
56 }
57
58
59
60
61
62
63 public DeployRequest getRequest()
64 {
65 return request;
66 }
67
68
69
70
71
72
73 public Collection<Artifact> getArtifacts()
74 {
75 return artifacts;
76 }
77
78
79
80
81
82
83
84 public DeployResult setArtifacts( Collection<Artifact> artifacts )
85 {
86 if ( artifacts == null )
87 {
88 this.artifacts = Collections.emptyList();
89 }
90 else
91 {
92 this.artifacts = artifacts;
93 }
94 return this;
95 }
96
97
98
99
100
101
102
103 public DeployResult addArtifact( Artifact artifact )
104 {
105 if ( artifact != null )
106 {
107 if ( artifacts.isEmpty() )
108 {
109 artifacts = new ArrayList<Artifact>();
110 }
111 artifacts.add( artifact );
112 }
113 return this;
114 }
115
116
117
118
119
120
121
122 public Collection<Metadata> getMetadata()
123 {
124 return metadata;
125 }
126
127
128
129
130
131
132
133 public DeployResult setMetadata( Collection<Metadata> metadata )
134 {
135 if ( metadata == null )
136 {
137 this.metadata = Collections.emptyList();
138 }
139 else
140 {
141 this.metadata = metadata;
142 }
143 return this;
144 }
145
146
147
148
149
150
151
152 public DeployResult addMetadata( Metadata metadata )
153 {
154 if ( metadata != null )
155 {
156 if ( this.metadata.isEmpty() )
157 {
158 this.metadata = new ArrayList<Metadata>();
159 }
160 this.metadata.add( metadata );
161 }
162 return this;
163 }
164
165 @Override
166 public String toString()
167 {
168 return getArtifacts() + ", " + getMetadata();
169 }
170
171 }