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