Class ObjectIdRef
- All Implemented Interfaces:
Ref
- Direct Known Subclasses:
ObjectIdRef.PeeledNonTag,ObjectIdRef.PeeledTag,ObjectIdRef.Unpeeled
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA reference to a non-tag object coming from a cached source.static classAn annotated tag whose peeled object has been cached.static classAny reference whose peeled value is not yet known.Nested classes/interfaces inherited from interface org.eclipse.jgit.lib.Ref
Ref.Storage -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate final ObjectIdprivate final Ref.Storageprivate final longFields inherited from interface org.eclipse.jgit.lib.Ref
UNDEFINED_UPDATE_INDEX -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedObjectIdRef(Ref.Storage st, String name, ObjectId id, long updateIndex) Create a new ref pairing. -
Method Summary
Modifier and TypeMethodDescriptiongetLeaf()Traverse target references untilRef.isSymbolic()is false.getName()What this ref is called within the repository.Cached value of this ref.How was this ref obtained?Get the reference this reference points to, orthis.longIndicator of the relative order between updates of a specific reference name.booleanTest if this reference is a symbolic reference.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.jgit.lib.Ref
getPeeledObjectId, isPeeled
-
Field Details
-
name
-
storage
-
objectId
-
updateIndex
private final long updateIndex
-
-
Constructor Details
-
ObjectIdRef
protected ObjectIdRef(@NonNull Ref.Storage st, @NonNull String name, @Nullable ObjectId id, long updateIndex) Create a new ref pairing.- Parameters:
st- method used to store this ref.name- name of this ref.id- current value of the ref. May benullto indicate a ref that does not exist yet.updateIndex- number that increases with each ref update. Set to -1 if the storage doesn't support versioning.- Since:
- 5.3
-
-
Method Details
-
getName
What this ref is called within the repository. -
isSymbolic
public boolean isSymbolic()Test if this reference is a symbolic reference.A symbolic reference does not have its own
ObjectIdvalue, but instead points to anotherRefin the same database and always uses that other reference's value as its own.- Specified by:
isSymbolicin interfaceRef- Returns:
- true if this is a symbolic reference; false if this reference contains its own ObjectId.
-
getLeaf
Traverse target references untilRef.isSymbolic()is false.If
Ref.isSymbolic()is false, returnsthis.If
Ref.isSymbolic()is true, this method recursively traversesRef.getTarget()untilRef.isSymbolic()returns false.This method is effectively
return isSymbolic() ? getTarget().getLeaf() : this;
-
getTarget
Get the reference this reference points to, orthis.If
Ref.isSymbolic()is true this method returns the reference it directly names, which might not be the leaf reference, but could be another symbolic reference.If this is a leaf level reference that contains its own ObjectId,this method returns
this. -
getObjectId
Cached value of this ref.- Specified by:
getObjectIdin interfaceRef- Returns:
- the value of this ref at the last time we read it. May be
nullto indicate a ref that does not exist yet or a symbolic ref pointing to an unborn branch.
-
getStorage
How was this ref obtained?The current storage model of a Ref may influence how the ref must be updated or deleted from the repository.
- Specified by:
getStoragein interfaceRef- Returns:
- type of ref.
-
getUpdateIndex
public long getUpdateIndex()Indicator of the relative order between updates of a specific reference name. A number that increases when a reference is updated.With symbolic references, the update index refers to updates of the symbolic reference itself. For example, if HEAD points to refs/heads/master, then the update index for exactRef("HEAD") will only increase when HEAD changes to point to another ref, regardless of how many times refs/heads/master is updated.
Should not be used unless the
RefDatabasethat instantiated the ref supports versioning (seeRefDatabase.hasVersioning())- Specified by:
getUpdateIndexin interfaceRef- Returns:
- the update index (i.e. version) of this reference.
- Since:
- 5.3
-
toString
-