Class GitObject

  • All Implemented Interfaces:
    Serializable
    Direct Known Subclasses:
    Branch, Tag

    @ExportedBean(defaultVisibility=999)
    public class GitObject
    extends Object
    implements Serializable
    An object in a git repository. Includes the SHA1 and name of the object stored in git (tag, branch, etc.).
    See Also:
    Serialized Form
    • Constructor Detail

      • GitObject

        public GitObject​(String name,
                         org.eclipse.jgit.lib.ObjectId sha1)
        Constructor for GitObject, a named SHA1 (tag, branch, etc.).
        Parameters:
        name - String name of this object
        sha1 - ObjectId which uniquely identifies this object
    • Method Detail

      • getSHA1

        public org.eclipse.jgit.lib.ObjectId getSHA1()
        Returns the SHA1 hash of this git object as an ObjectId.
        Returns:
        ObjectId SHA1 of the object.
      • getName

        @Exported
        public String getName()
        Returns the name of this git object (branch name, tag name, etc.).
        Returns:
        String name of the object.
      • getSHA1String

        @Exported(name="SHA1")
        public String getSHA1String()
        Returns the SHA1 hash of this git object as a String.
        Returns:
        String SHA1 of the object.
      • hashCode

        public int hashCode()
        Returns a hash code value for the object. Considers sha1 and name in the calculation.
        Overrides:
        hashCode in class Object
        Returns:
        a hash code value for this object.
      • equals

        public boolean equals​(Object obj)
        Indicates whether some other object is "equal to" this one. Includes sha1 and name in the comparison. Objects of subclasses of this object are not equal to objects of this class, even if they add no fields.
        Overrides:
        equals in class Object
        Parameters:
        obj - the reference object with which to compare.
        Returns:
        true if this object is the same as the obj argument; false otherwise