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