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 @NonNull
40 private final List<String> serverOptions;
41
42 private LsRefsV2Request(List<String> refPrefixes, boolean symrefs,
43 boolean peel, @Nullable String agent,
44 @NonNull List<String> serverOptions) {
45 this.refPrefixes = refPrefixes;
46 this.symrefs = symrefs;
47 this.peel = peel;
48 this.agent = agent;
49 this.serverOptions = requireNonNull(serverOptions);
50 }
51
52
53 public List<String> getRefPrefixes() {
54 return refPrefixes;
55 }
56
57
58 public boolean getSymrefs() {
59 return symrefs;
60 }
61
62
63 public boolean getPeel() {
64 return peel;
65 }
66
67
68
69
70
71
72 @Nullable
73 public String getAgent() {
74 return agent;
75 }
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90 @NonNull
91 public List<String> getServerOptions() {
92 return serverOptions;
93 }
94
95
96 public static Builder builder() {
97 return new Builder();
98 }
99
100
101 public static final class Builder {
102 private List<String> refPrefixes = Collections.emptyList();
103
104 private boolean symrefs;
105
106 private boolean peel;
107
108 private final List<String> serverOptions = new ArrayList<>();
109
110 private String agent;
111
112 private Builder() {
113 }
114
115
116
117
118
119 public Builder setRefPrefixes(List<String> value) {
120 refPrefixes = value;
121 return this;
122 }
123
124
125
126
127
128 public Builder setSymrefs(boolean value) {
129 symrefs = value;
130 return this;
131 }
132
133
134
135
136
137 public Builder setPeel(boolean value) {
138 peel = value;
139 return this;
140 }
141
142
143
144
145
146
147
148
149
150
151
152
153 public Builder addServerOption(@NonNull String value) {
154 serverOptions.add(value);
155 return this;
156 }
157
158
159
160
161
162
163
164
165
166
167
168
169 public Builder setAgent(@Nullable String value) {
170 agent = value;
171 return this;
172 }
173
174
175 public LsRefsV2Request build() {
176 return new LsRefsV2Request(
177 Collections.unmodifiableList(refPrefixes), symrefs, peel,
178 agent, Collections.unmodifiableList(serverOptions));
179 }
180 }
181 }