SubmoduleStatus.java

  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. import org.eclipse.jgit.lib.ObjectId;

  12. /**
  13.  * Status class containing the type, path, and commit id of the submodule.
  14.  */
  15. public class SubmoduleStatus {

  16.     private final SubmoduleStatusType type;

  17.     private final String path;

  18.     private final ObjectId indexId;

  19.     private final ObjectId headId;

  20.     /**
  21.      * Create submodule status
  22.      *
  23.      * @param type
  24.      *            a {@link org.eclipse.jgit.submodule.SubmoduleStatusType}
  25.      *            object.
  26.      * @param path
  27.      *            submodule path
  28.      * @param indexId
  29.      *            an {@link org.eclipse.jgit.lib.ObjectId} object.
  30.      */
  31.     public SubmoduleStatus(final SubmoduleStatusType type, final String path,
  32.             final ObjectId indexId) {
  33.         this(type, path, indexId, null);
  34.     }

  35.     /**
  36.      * Create submodule status
  37.      *
  38.      * @param type
  39.      *            a {@link org.eclipse.jgit.submodule.SubmoduleStatusType}
  40.      *            object.
  41.      * @param path
  42.      *            submodule path
  43.      * @param indexId
  44.      *            index id
  45.      * @param headId
  46.      *            head id
  47.      */
  48.     public SubmoduleStatus(final SubmoduleStatusType type, final String path,
  49.             final ObjectId indexId, final ObjectId headId) {
  50.         this.type = type;
  51.         this.path = path;
  52.         this.indexId = indexId;
  53.         this.headId = headId;
  54.     }

  55.     /**
  56.      * Get type
  57.      *
  58.      * @return type
  59.      */
  60.     public SubmoduleStatusType getType() {
  61.         return type;
  62.     }

  63.     /**
  64.      * Get submodule path
  65.      *
  66.      * @return path submodule path
  67.      */
  68.     public String getPath() {
  69.         return path;
  70.     }

  71.     /**
  72.      * Get index object id
  73.      *
  74.      * @return index object id
  75.      */
  76.     public ObjectId getIndexId() {
  77.         return indexId;
  78.     }

  79.     /**
  80.      * Get HEAD object id
  81.      *
  82.      * @return HEAD object id
  83.      */
  84.     public ObjectId getHeadId() {
  85.         return headId;
  86.     }
  87. }