Package org.apache.commons.codec.digest
Class GitIdentifiers.DirectoryEntry
- java.lang.Object
-
- org.apache.commons.codec.digest.GitIdentifiers.DirectoryEntry
-
- All Implemented Interfaces:
java.lang.Comparable<GitIdentifiers.DirectoryEntry>
- Enclosing class:
- GitIdentifiers
static class GitIdentifiers.DirectoryEntry extends java.lang.Object implements java.lang.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 thatfoo/sorts afterfoobar.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringnameThe entry name (file or directory name, no path separator).private byte[]rawObjectIdThe raw object id of the referenced blob or sub-tree.private java.lang.StringsortKeyThe key used for ordering entries within a tree object.private GitIdentifiers.FileModetypeThe Git object type, which determines the Unix file-mode prefix.
-
Constructor Summary
Constructors Constructor Description DirectoryEntry(java.lang.String name, GitIdentifiers.FileMode type, byte[] rawObjectId)Constructs a new entry.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(GitIdentifiers.DirectoryEntry o)booleanequals(java.lang.Object obj)inthashCode()
-
-
-
Field Detail
-
name
private final java.lang.String name
The entry name (file or directory name, no path separator).
-
rawObjectId
private final byte[] rawObjectId
The raw object id of the referenced blob or sub-tree.
-
sortKey
private final java.lang.String sortKey
The key used for ordering entries within a tree object.>Git appends
'/'to directory names before comparing.
-
type
private final GitIdentifiers.FileMode type
The Git object type, which determines the Unix file-mode prefix.
-
-
Constructor Detail
-
DirectoryEntry
DirectoryEntry(java.lang.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 Detail
-
compareTo
public int compareTo(GitIdentifiers.DirectoryEntry o)
- Specified by:
compareToin interfacejava.lang.Comparable<GitIdentifiers.DirectoryEntry>
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-