Package org.eclipse.jgit.lib
Class SymbolicRef
- java.lang.Object
-
- org.eclipse.jgit.lib.SymbolicRef
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.jgit.lib.Ref
Ref.Storage
-
-
Constructor Summary
Constructors Constructor Description SymbolicRef(String refName, Ref target)Create a new ref pairing.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RefgetLeaf()Traverse target references untilRef.isSymbolic()is false.StringgetName()What this ref is called within the repository.ObjectIdgetObjectId()Cached value of this ref.ObjectIdgetPeeledObjectId()Cached value ofref^{}(the ref peeled to commit).Ref.StoragegetStorage()How was this ref obtained?RefgetTarget()Get the reference this reference points to, orthis.booleanisPeeled()booleanisSymbolic()Test if this reference is a symbolic reference.StringtoString()
-
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:RefWhat this ref is called within the repository.
-
isSymbolic
public boolean isSymbolic()
Description copied from interface:RefTest 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
public Ref getLeaf()
Description copied from interface:RefTraverse 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
public Ref getTarget()
Description copied from interface:RefGet 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
public ObjectId getObjectId()
Description copied from interface:RefCached value of this ref.- Specified by:
getObjectIdin interfaceRef- Returns:
- the value of this ref at the last time we read it.
-
getStorage
public Ref.Storage getStorage()
Description copied from interface:RefHow 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.
-
getPeeledObjectId
public ObjectId getPeeledObjectId()
Description copied from interface:RefCached value ofref^{}(the ref peeled to commit).- Specified by:
getPeeledObjectIdin interfaceRef- Returns:
- if this ref is an annotated tag the id of the commit (or tree or blob) that the annotated tag refers to; null if this ref does not refer to an annotated tag.
-
isPeeled
public boolean isPeeled()
-
-