1
2
3
4
5
6
7
8
9
10 package org.eclipse.jgit.transport;
11
12 import static java.util.Objects.requireNonNull;
13
14 import java.util.ArrayList;
15 import java.util.Collections;
16 import java.util.List;
17
18 import org.eclipse.jgit.annotations.NonNull;
19 import org.eclipse.jgit.annotations.Nullable;
20
21
22
23
24
25
26
27
28
29 public final class LsRefsV2Request {
30 private final List<String> refPrefixes;
31
32 private final boolean symrefs;
33
34 private final boolean peel;
35
36 @Nullable
37 private final String agent;
38
39 private final String clientSID;
40
41 @NonNull
42 private final List<String> serverOptions;
43
44 private LsRefsV2Request(List<String> refPrefixes, boolean symrefs,
45 boolean peel, @Nullable String agent,
46 @NonNull List<String> serverOptions,
47 @Nullable String clientSID) {
48 this.refPrefixes = refPrefixes;
49 this.symrefs = symrefs;
50 this.peel = peel;
51 this.agent = agent;
52 this.serverOptions = requireNonNull(serverOptions);
53 this.clientSID = clientSID;
54 }
55
56
57 public List<String> getRefPrefixes() {
58 return refPrefixes;
59 }
60
61
62 public boolean getSymrefs() {
63 return symrefs;
64 }
65
66
67 public boolean getPeel() {
68 return peel;
69 }
70
71
72
73
74
75
76 @Nullable
77 public String getAgent() {
78 return agent;
79 }
80
81
82
83
84
85
86 @Nullable
87 public String getClientSID() {
88 return clientSID;
89 }
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104 @NonNull
105 public List<String> getServerOptions() {
106 return serverOptions;
107 }
108
109
110 public static Builder builder() {
111 return new Builder();
112 }
113
114
115 public static final class Builder {
116 private List<String> refPrefixes = Collections.emptyList();
117
118 private boolean symrefs;
119
120 private boolean peel;
121
122 private final List<String> serverOptions = new ArrayList<>();
123
124 private String agent;
125
126 private String clientSID;
127
128 private Builder() {
129 }
130
131
132
133
134
135 public Builder setRefPrefixes(List<String> value) {
136 refPrefixes = value;
137 return this;
138 }
139
140
141
142
143
144 public Builder setSymrefs(boolean value) {
145 symrefs = value;
146 return this;
147 }
148
149
150
151
152
153 public Builder setPeel(boolean value) {
154 peel = value;
155 return this;
156 }
157
158
159
160
161
162
163
164
165
166
167
168
169 public Builder addServerOption(@NonNull String value) {
170 serverOptions.add(value);
171 return this;
172 }
173
174
175
176
177
178
179
180
181
182
183
184
185 public Builder setAgent(@Nullable String value) {
186 agent = value;
187 return this;
188 }
189
190
191
192
193
194
195
196
197
198
199
200
201 public Builder setClientSID(@Nullable String value) {
202 clientSID = value;
203 return this;
204 }
205
206
207 public LsRefsV2Request build() {
208 return new LsRefsV2Request(
209 Collections.unmodifiableList(refPrefixes), symrefs, peel,
210 agent, Collections.unmodifiableList(serverOptions),
211 clientSID);
212 }
213 }
214 }