public abstract class ObjectIdRef extends Object implements Ref
Modifier and Type | Class and Description |
---|---|
static class |
ObjectIdRef.PeeledNonTag
A reference to a non-tag object coming from a cached source.
|
static class |
ObjectIdRef.PeeledTag
An annotated tag whose peeled object has been cached.
|
static class |
ObjectIdRef.Unpeeled
Any reference whose peeled value is not yet known.
|
Ref.Storage
UNDEFINED_UPDATE_INDEX
Modifier | Constructor and Description |
---|---|
protected |
ObjectIdRef(Ref.Storage st,
String name,
ObjectId id,
long updateIndex)
Create a new ref pairing.
|
Modifier and Type | Method and Description |
---|---|
Ref |
getLeaf()
Traverse target references until
Ref.isSymbolic() is false. |
String |
getName()
What this ref is called within the repository.
|
ObjectId |
getObjectId()
Cached value of this ref.
|
Ref.Storage |
getStorage()
How was this ref obtained?
|
Ref |
getTarget()
Get the reference this reference points to, or
this . |
long |
getUpdateIndex()
Indicator of the relative order between updates of a specific reference
name.
|
boolean |
isSymbolic()
Test if this reference is a symbolic reference.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getPeeledObjectId, isPeeled
protected ObjectIdRef(@NonNull Ref.Storage st, @NonNull String name, @Nullable ObjectId id, long updateIndex)
st
- method used to store this ref.name
- name of this ref.id
- current value of the ref. May be null
to 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.public boolean isSymbolic()
A symbolic reference does not have its own
ObjectId
value, but instead points to
another Ref
in the same database and always uses that other
reference's value as its own.
isSymbolic
in interface Ref
@NonNull public Ref getLeaf()
Ref.isSymbolic()
is false.
If Ref.isSymbolic()
is false, returns this
.
If Ref.isSymbolic()
is true, this method recursively traverses
Ref.getTarget()
until Ref.isSymbolic()
returns false.
This method is effectively
return isSymbolic() ? getTarget().getLeaf() : this;
@NonNull public Ref getTarget()
this
.
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
.
@Nullable public ObjectId getObjectId()
getObjectId
in interface Ref
null
to indicate a ref that does not exist yet or a
symbolic ref pointing to an unborn branch.@NonNull public Ref.Storage getStorage()
The current storage model of a Ref may influence how the ref must be updated or deleted from the repository.
getStorage
in interface Ref
public long getUpdateIndex()
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 RefDatabase
that instantiated the
ref supports versioning (see RefDatabase.hasVersioning()
)
getUpdateIndex
in interface Ref
Copyright © 2020 Eclipse JGit Project. All rights reserved.