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

public abstract Class ObjectIdRef

extends Object
implements Ref
Class Inheritance
All Implemented Interfaces
org.eclipse.jgit.lib.Ref
Known Direct Subclasses
org.eclipse.jgit.lib.ObjectIdRef.Unpeeled, org.eclipse.jgit.lib.ObjectIdRef.PeeledTag, org.eclipse.jgit.lib.ObjectIdRef.PeeledNonTag
Imports
org.eclipse.jgit.annotations.NonNull, .Nullable

A org.eclipse.jgit.lib.Ref that points directly at an org.eclipse.jgit.lib.ObjectId.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
ObjectIdRef.PeeledNonTag

A reference to a non-tag object coming from a cached source.

public static class
ObjectIdRef.PeeledTag

An annotated tag whose peeled object has been cached.

public static class
ObjectIdRef.Unpeeled

Any reference whose peeled value is not yet known.

Field Summary

Modifier and TypeField and Description
private final String
private final ObjectId
private final Ref.Storage
private final long

Constructor Summary

AccessConstructor and Description
protected
ObjectIdRef(Ref.Storage
method used to store this ref.
st
,
String
name of this ref.
name
,
ObjectId
current value of the ref. May be null to indicate a ref that does not exist yet.
id
,
long
number that increases with each ref update. Set to -1 if the storage doesn't support versioning.
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 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
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
objectIdback to summary
private final ObjectId objectId
storageback to summary
private final Ref.Storage storage
updateIndexback to summary
private final long updateIndex

Constructor Detail

ObjectIdRefback to summary
protected ObjectIdRef(Ref.Storage st, String name, ObjectId id, long updateIndex)

Create a new ref pairing.

Parameters
st:Ref.Storage

method used to store this ref.

name:String

name of this ref.

id:ObjectId

current value of the ref. May be null to indicate a ref that does not exist yet.

updateIndex:long

number that increases with each ref update. Set to -1 if the storage doesn't support versioning.

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
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
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
@NonNull
@Override
org.eclipse.jgit.lib back to summary

public Class ObjectIdRef.PeeledNonTag

extends ObjectIdRef
Class Inheritance
Known Direct Subclasses
org.eclipse.jgit.internal.storage.file.RefDirectory.LooseNonTag

A reference to a non-tag object coming from a cached source.

Constructor Summary

AccessConstructor and Description
public
PeeledNonTag(Ref.Storage
method used to store this ref.
st
,
String
name of this ref.
name
,
ObjectId
current value of the ref. May be null to indicate a ref that does not exist yet.
id
)

Create a new ref pairing.

public
PeeledNonTag(Ref.Storage
method used to store this ref.
st
,
String
name of this ref.
name
,
ObjectId
current value of the ref. May be null to indicate a ref that does not exist yet.
id
,
long
number increasing with each update to the reference.
updateIndex
)

Create a new ref pairing with update index.

Method Summary

Modifier and TypeMethod and Description
public ObjectId
getPeeledObjectId()

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

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

public boolean
isPeeled()

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

Whether the Ref represents a peeled tag.

Inherited from org.eclipse.jgit.lib.ObjectIdRef:
getLeafgetNamegetObjectIdgetStoragegetTargetgetUpdateIndexisSymbolictoString

Constructor Detail

PeeledNonTagback to summary
public PeeledNonTag(Ref.Storage st, String name, ObjectId id)

Create a new ref pairing.

Parameters
st:Ref.Storage

method used to store this ref.

name:String

name of this ref.

id:ObjectId

current value of the ref. May be null to indicate a ref that does not exist yet.

PeeledNonTagback to summary
public PeeledNonTag(Ref.Storage st, String name, ObjectId id, long updateIndex)

Create a new ref pairing with update index.

Parameters
st:Ref.Storage

method used to store this ref.

name:String

name of this ref.

id:ObjectId

current value of the ref. May be null to indicate a ref that does not exist yet.

updateIndex:long

number increasing with each update to the reference.

Since
5.3

Method Detail

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
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
org.eclipse.jgit.lib back to summary

public Class ObjectIdRef.PeeledTag

extends ObjectIdRef
Class Inheritance
Known Direct Subclasses
org.eclipse.jgit.internal.storage.file.RefDirectory.LoosePeeledTag

An annotated tag whose peeled object has been cached.

Field Summary

Modifier and TypeField and Description
private final ObjectId

Constructor Summary

AccessConstructor and Description
public
PeeledTag(Ref.Storage
method used to store this ref.
st
,
String
name of this ref.
name
,
ObjectId
current value of the ref.
id
,
ObjectId
the first non-tag object that tag id points to.
p
)

Create a new ref pairing.

public
PeeledTag(Ref.Storage
method used to store this ref.
st
,
String
name of this ref.
name
,
ObjectId
current value of the ref. May be null to indicate a ref that does not exist yet.
id
,
ObjectId
the first non-tag object that tag id points to.
p
,
long
number increasing with each update to the reference.
updateIndex
)

Create a new ref pairing with update index.

Method Summary

Modifier and TypeMethod and Description
public ObjectId
getPeeledObjectId()

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

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

public boolean
isPeeled()

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

Whether the Ref represents a peeled tag.

Inherited from org.eclipse.jgit.lib.ObjectIdRef:
getLeafgetNamegetObjectIdgetStoragegetTargetgetUpdateIndexisSymbolictoString

Field Detail

peeledObjectIdback to summary
private final ObjectId peeledObjectId

Constructor Detail

PeeledTagback to summary
public PeeledTag(Ref.Storage st, String name, ObjectId id, ObjectId p)

Create a new ref pairing.

Parameters
st:Ref.Storage

method used to store this ref.

name:String

name of this ref.

id:ObjectId

current value of the ref.

p:ObjectId

the first non-tag object that tag id points to.

PeeledTagback to summary
public PeeledTag(Ref.Storage st, String name, ObjectId id, ObjectId p, long updateIndex)

Create a new ref pairing with update index.

Parameters
st:Ref.Storage

method used to store this ref.

name:String

name of this ref.

id:ObjectId

current value of the ref. May be null to indicate a ref that does not exist yet.

p:ObjectId

the first non-tag object that tag id points to.

updateIndex:long

number increasing with each update to the reference.

Since
5.3

Method Detail

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
@NonNull
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
org.eclipse.jgit.lib back to summary

public Class ObjectIdRef.Unpeeled

extends ObjectIdRef
Class Inheritance
Known Direct Subclasses
org.eclipse.jgit.internal.storage.file.RefDirectory.LooseUnpeeled

Any reference whose peeled value is not yet known.

Constructor Summary

AccessConstructor and Description
public
Unpeeled(Ref.Storage
method used to store this ref.
st
,
String
name of this ref.
name
,
ObjectId
current value of the ref. May be null to indicate a ref that does not exist yet.
id
)

Create a new ref pairing.

public
Unpeeled(Ref.Storage
method used to store this ref.
st
,
String
name of this ref.
name
,
ObjectId
current value of the ref. May be null to indicate a ref that does not exist yet.
id
,
long
number increasing with each update to the reference.
updateIndex
)

Create a new ref pairing with update index.

Method Summary

Modifier and TypeMethod and Description
public ObjectId
getPeeledObjectId()

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

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

public boolean
isPeeled()

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

Whether the Ref represents a peeled tag.

Inherited from org.eclipse.jgit.lib.ObjectIdRef:
getLeafgetNamegetObjectIdgetStoragegetTargetgetUpdateIndexisSymbolictoString

Constructor Detail

Unpeeledback to summary
public Unpeeled(Ref.Storage st, String name, ObjectId id)

Create a new ref pairing.

Parameters
st:Ref.Storage

method used to store this ref.

name:String

name of this ref.

id:ObjectId

current value of the ref. May be null to indicate a ref that does not exist yet.

Unpeeledback to summary
public Unpeeled(Ref.Storage st, String name, ObjectId id, long updateIndex)

Create a new ref pairing with update index.

Parameters
st:Ref.Storage

method used to store this ref.

name:String

name of this ref.

id:ObjectId

current value of the ref. May be null to indicate a ref that does not exist yet.

updateIndex:long

number increasing with each update to the reference.

Since
5.3

Method Detail

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