1 /*
2 * Copyright (C) 2021, Google LLC. and others
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Distribution License v. 1.0 which is available at
6 * https://www.eclipse.org/org/documents/edl-v10.php.
7 *
8 * SPDX-License-Identifier: BSD-3-Clause
9 */
10 package org.eclipse.jgit.transport;
11
12 import java.util.Collections;
13 import java.util.List;
14
15 import org.eclipse.jgit.lib.ObjectId;
16
17 /**
18 * object-info request.
19 *
20 * <p>
21 * This is the parsed request for an object-info call, used as input to
22 * {@link ProtocolV2Hook}.
23 *
24 * @see <a href=
25 * "https://www.kernel.org/pub/software/scm/git/docs/technical/protocol-v2.html#_object_info">object-info
26 * documentation</a>
27 *
28 * @since 5.13
29 */
30 public final class ObjectInfoRequest {
31 private final List<ObjectId> objectIDs;
32
33 private ObjectInfoRequest(List<ObjectId> objectIDs) {
34 this.objectIDs = objectIDs;
35 }
36
37 /** @return object IDs that the client requested. */
38 public List<ObjectId> getObjectIDs() {
39 return this.objectIDs;
40 }
41
42 /** @return A builder of {@link ObjectInfoRequest}. */
43 public static Builder builder() {
44 return new Builder();
45 }
46
47 /** A builder for {@link ObjectInfoRequest}. */
48 public static final class Builder {
49 private List<ObjectId> objectIDs = Collections.emptyList();
50
51 private Builder() {
52 }
53
54 /**
55 * @param value
56 * @return the Builder
57 */
58 public Builder setObjectIDs(List<ObjectId> value) {
59 objectIDs = value;
60 return this;
61 }
62
63 /** @return ObjectInfoRequest */
64 public ObjectInfoRequest build() {
65 return new ObjectInfoRequest(
66 Collections.unmodifiableList(objectIDs));
67 }
68 }
69 }