aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/transport/ObjectInfoRequest.java
blob: 86a2716675063f7ea7e9c65b8bc9b55348afdb47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
 * Copyright (C) 2021, Google LLC. and others
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Distribution License v. 1.0 which is available at
 * https://www.eclipse.org/org/documents/edl-v10.php.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */
package org.eclipse.jgit.transport;

import java.util.Collections;
import java.util.List;

import org.eclipse.jgit.lib.ObjectId;

/**
 * object-info request.
 *
 * <p>
 * This is the parsed request for an object-info call, used as input to
 * {@link ProtocolV2Hook}.
 *
 * @see <a href=
 *      "https://www.kernel.org/pub/software/scm/git/docs/technical/protocol-v2.html#_object_info">object-info
 *      documentation</a>
 *
 * @since 5.13
 */
public final class ObjectInfoRequest {
	private final List<ObjectId> objectIDs;

	private ObjectInfoRequest(List<ObjectId> objectIDs) {
		this.objectIDs = objectIDs;
	}

	/** @return object IDs that the client requested. */
	public List<ObjectId> getObjectIDs() {
		return this.objectIDs;
	}

	/** @return A builder of {@link ObjectInfoRequest}. */
	public static Builder builder() {
		return new Builder();
	}

	/** A builder for {@link ObjectInfoRequest}. */
	public static final class Builder {
		private List<ObjectId> objectIDs = Collections.emptyList();

		private Builder() {
		}

		/**
		 * @param value
		 * @return the Builder
		 */
		public Builder setObjectIDs(List<ObjectId> value) {
			objectIDs = value;
			return this;
		}

		/** @return ObjectInfoRequest */
		public ObjectInfoRequest build() {
			return new ObjectInfoRequest(
					Collections.unmodifiableList(objectIDs));
		}
	}
}