Package org.apache.commons.codec.digest
Class GitIdentifiers.DirectoryEntry
java.lang.Object
org.apache.commons.codec.digest.GitIdentifiers.DirectoryEntry
- All Implemented Interfaces:
Comparable<GitIdentifiers.DirectoryEntry>
- Enclosing class:
- GitIdentifiers
static class GitIdentifiers.DirectoryEntry
extends Object
implements Comparable<GitIdentifiers.DirectoryEntry>
Represents a single entry in a Git tree object.
A Git tree object encodes a directory snapshot. Each entry holds:
- a
GitIdentifiers.FileModethat determines the Unix file mode (e.g.100644for a regular file), - the entry name (file or directory name, without a path separator),
- the raw object id of the referenced blob or sub-tree.
Entries are ordered by compareTo(org.apache.commons.codec.digest.GitIdentifiers.DirectoryEntry) using Git's tree-sort rule: directory names are compared as if they ended with '/', so that foo/
sorts after foobar.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StringThe entry name (file or directory name, no path separator).private final byte[]The raw object id of the referenced blob or sub-tree.private final StringThe key used for ordering entries within a tree object.private final GitIdentifiers.FileModeThe Git object type, which determines the Unix file-mode prefix. -
Constructor Summary
ConstructorsConstructorDescriptionDirectoryEntry(String name, GitIdentifiers.FileMode type, byte[] rawObjectId) Constructs a new entry. -
Method Summary
-
Field Details
-
name
The entry name (file or directory name, no path separator). -
rawObjectId
private final byte[] rawObjectIdThe raw object id of the referenced blob or sub-tree. -
sortKey
The key used for ordering entries within a tree object.>Git appends
'/'to directory names before comparing. -
type
The Git object type, which determines the Unix file-mode prefix.
-
-
Constructor Details
-
DirectoryEntry
DirectoryEntry(String name, GitIdentifiers.FileMode type, byte[] rawObjectId) Constructs a new entry.- Parameters:
name- The name of the entry, not containing'/'.type- The type of the entry, not null.rawObjectId- The id of the entry, not null.
-
-
Method Details
-
compareTo
- Specified by:
compareToin interfaceComparable<GitIdentifiers.DirectoryEntry>
-
equals
-
hashCode
public int hashCode()
-