Top Description Fields Constructors Methods
org.eclipse.jgit.lib

public Class SymbolicRef

extends Object
implements Ref
Class Inheritance
All Implemented Interfaces
org.eclipse.jgit.lib.Ref
Known Direct Subclasses
org.eclipse.jgit.internal.storage.file.RefDirectory.LooseSymbolicRef
Imports
org.eclipse.jgit.annotations.NonNull, .Nullable

A reference that indirectly points at another org.eclipse.jgit.lib.Ref.

A symbolic reference always derives its current value from the target reference.

Field Summary

Modifier and TypeField and Description
private final String
private final Ref
private final long

Constructor Summary

AccessConstructor and Description
public
SymbolicRef(String
name of this ref.
refName
,
Ref
the ref we reference and derive our value from.
target
)

Create a new ref pairing.

public
SymbolicRef(String
name of this ref.
refName
,
Ref
the ref we reference and derive our value from.
target
,
long
index that increases with each update of the reference
updateIndex
)

Create a new ref pairing.

Method Summary

Modifier and TypeMethod and Description
public Ref
getLeaf()

Implements org.eclipse.jgit.lib.Ref.getLeaf.

Traverse target references until isSymbolic() is false.

public String
getName()

Implements org.eclipse.jgit.lib.Ref.getName.

What this ref is called within the repository.

public ObjectId
getObjectId()

Implements org.eclipse.jgit.lib.Ref.getObjectId.

Cached value of this ref.

public ObjectId
getPeeledObjectId()

Implements org.eclipse.jgit.lib.Ref.getPeeledObjectId.

Cached value of ref^{} (the ref peeled to commit).

public Ref.Storage
getStorage()

Implements org.eclipse.jgit.lib.Ref.getStorage.

How was this ref obtained?

public Ref
getTarget()

Implements org.eclipse.jgit.lib.Ref.getTarget.

Get the reference this reference points to, or this.

public long
getUpdateIndex()

Overrides default org.eclipse.jgit.lib.Ref.getUpdateIndex.

Indicator of the relative order between updates of a specific reference name.

public boolean
isPeeled()

Implements org.eclipse.jgit.lib.Ref.isPeeled.

Whether the Ref represents a peeled tag.

public boolean
isSymbolic()

Implements org.eclipse.jgit.lib.Ref.isSymbolic.

Test if this reference is a symbolic reference.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

nameback to summary
private final String name
targetback to summary
private final Ref target
updateIndexback to summary
private final long updateIndex

Constructor Detail

SymbolicRefback to summary
public SymbolicRef(String refName, Ref target)

Create a new ref pairing.

Parameters
refName:String

name of this ref.

target:Ref

the ref we reference and derive our value from.

SymbolicRefback to summary
public SymbolicRef(String refName, Ref target, long updateIndex)

Create a new ref pairing.

Parameters
refName:String

name of this ref.

target:Ref

the ref we reference and derive our value from.

updateIndex:long

index that increases with each update of the reference

Since
5.3

Method Detail

getLeafback to summary
public Ref getLeaf()

Implements org.eclipse.jgit.lib.Ref.getLeaf.

Doc from org.eclipse.jgit.lib.Ref.getLeaf.

Traverse target references until isSymbolic() is false.

If isSymbolic() is false, returns this.

If isSymbolic() is true, this method recursively traverses getTarget() until isSymbolic() returns false.

This method is effectively

return isSymbolic() ? getTarget().getLeaf() : this;
Returns:Ref

the reference that actually stores the ObjectId value.

Annotations
@Override
@NonNull
getNameback to summary
public String getName()

Implements org.eclipse.jgit.lib.Ref.getName.

Doc from org.eclipse.jgit.lib.Ref.getName.

What this ref is called within the repository.

Returns:String

name of this ref.

Annotations
@Override
@NonNull
getObjectIdback to summary
public ObjectId getObjectId()

Implements org.eclipse.jgit.lib.Ref.getObjectId.

Doc from org.eclipse.jgit.lib.Ref.getObjectId.

Cached value of this ref.

Returns:ObjectId

the value of this ref at the last time we read it. May be null to indicate a ref that does not exist yet or a symbolic ref pointing to an unborn branch.

Annotations
@Override
@Nullable
getPeeledObjectIdback to summary
public ObjectId getPeeledObjectId()

Implements org.eclipse.jgit.lib.Ref.getPeeledObjectId.

Doc from org.eclipse.jgit.lib.Ref.getPeeledObjectId.

Cached value of ref^{} (the ref peeled to commit).

Returns:ObjectId

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.

Annotations
@Override
@Nullable
getStorageback to summary
public Ref.Storage getStorage()

Implements org.eclipse.jgit.lib.Ref.getStorage.

Doc from org.eclipse.jgit.lib.Ref.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.

Returns:Ref.Storage

type of ref.

Annotations
@Override
@NonNull
getTargetback to summary
public Ref getTarget()

Implements org.eclipse.jgit.lib.Ref.getTarget.

Doc from org.eclipse.jgit.lib.Ref.getTarget.

Get the reference this reference points to, or this.

If 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.

Returns:Ref

the target reference, or this.

Annotations
@Override
@NonNull
getUpdateIndexback to summary
public long getUpdateIndex()

Overrides default org.eclipse.jgit.lib.Ref.getUpdateIndex.

Doc from org.eclipse.jgit.lib.Ref.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 RefDatabase that instantiated the ref supports versioning (see RefDatabase#hasVersioning())

Returns:long

the update index (i.e. version) of this reference.

Annotations
@Override
Since
5.3
isPeeledback to summary
public boolean isPeeled()

Implements org.eclipse.jgit.lib.Ref.isPeeled.

Doc from org.eclipse.jgit.lib.Ref.isPeeled.

Whether the Ref represents a peeled tag.

Returns:boolean

whether the Ref represents a peeled tag.

Annotations
@Override
isSymbolicback to summary
public boolean isSymbolic()

Implements org.eclipse.jgit.lib.Ref.isSymbolic.

Doc from org.eclipse.jgit.lib.Ref.isSymbolic.

Test if this reference is a symbolic reference.

A symbolic reference does not have its own org.eclipse.jgit.lib.ObjectId value, but instead points to another Ref in the same database and always uses that other reference's value as its own.

Returns:boolean

true if this is a symbolic reference; false if this reference contains its own ObjectId.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@SuppressWarnings:nls
@Override