View Javadoc
1   /*
2    * Copyright (C) 2011, GitHub Inc. 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.submodule;
11  
12  import org.eclipse.jgit.lib.ObjectId;
13  
14  /**
15   * Status class containing the type, path, and commit id of the submodule.
16   */
17  public class SubmoduleStatus {
18  
19  	private final SubmoduleStatusType type;
20  
21  	private final String path;
22  
23  	private final ObjectId indexId;
24  
25  	private final ObjectId headId;
26  
27  	/**
28  	 * Create submodule status
29  	 *
30  	 * @param type
31  	 *            a {@link org.eclipse.jgit.submodule.SubmoduleStatusType}
32  	 *            object.
33  	 * @param path
34  	 *            submodule path
35  	 * @param indexId
36  	 *            an {@link org.eclipse.jgit.lib.ObjectId} object.
37  	 */
38  	public SubmoduleStatus(final SubmoduleStatusType type, final String path,
39  			final ObjectId indexId) {
40  		this(type, path, indexId, null);
41  	}
42  
43  	/**
44  	 * Create submodule status
45  	 *
46  	 * @param type
47  	 *            a {@link org.eclipse.jgit.submodule.SubmoduleStatusType}
48  	 *            object.
49  	 * @param path
50  	 *            submodule path
51  	 * @param indexId
52  	 *            index id
53  	 * @param headId
54  	 *            head id
55  	 */
56  	public SubmoduleStatus(final SubmoduleStatusType type, final String path,
57  			final ObjectId indexId, final ObjectId headId) {
58  		this.type = type;
59  		this.path = path;
60  		this.indexId = indexId;
61  		this.headId = headId;
62  	}
63  
64  	/**
65  	 * Get type
66  	 *
67  	 * @return type
68  	 */
69  	public SubmoduleStatusType getType() {
70  		return type;
71  	}
72  
73  	/**
74  	 * Get submodule path
75  	 *
76  	 * @return path submodule path
77  	 */
78  	public String getPath() {
79  		return path;
80  	}
81  
82  	/**
83  	 * Get index object id
84  	 *
85  	 * @return index object id
86  	 */
87  	public ObjectId getIndexId() {
88  		return indexId;
89  	}
90  
91  	/**
92  	 * Get HEAD object id
93  	 *
94  	 * @return HEAD object id
95  	 */
96  	public ObjectId getHeadId() {
97  		return headId;
98  	}
99  }