org.eclipse.jgit.lib

## Class ObjectIdRef

- java.lang.Object
- - org.eclipse.jgit.lib.ObjectIdRef

All Implemented Interfaces:
  Ref

Direct Known Subclasses:
  ObjectIdRef.PeeledNonTag, ObjectIdRef.PeeledTag, ObjectIdRef.Unpeeled

    public abstract class ObjectIdRef
    extends Object
    implements Ref

A `Ref` that points directly at an `ObjectId`.

### Nested Class Summary

Nested Classes
`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.

### Nested classes/interfaces inherited from interface org.eclipse.jgit.lib.Ref

`Ref.Storage`

### Constructor Summary

Constructors
`protected` `ObjectIdRef(Ref.Storage st, String name, ObjectId id)` Create a new ref pairing.

### Method Summary

All Methods Instance Methods Concrete Methods
`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`.
`boolean` `isSymbolic()` Test if this reference is a symbolic reference.
`String` `toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.eclipse.jgit.lib.Ref

`getPeeledObjectId, isPeeled`

### Constructor Detail

#### ObjectIdRef

    protected ObjectIdRef(Ref.Storage st,
                          String name,
                          ObjectId id)

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 be null to indicate a ref that does not exist yet.

### Method Detail

#### getName

    public String getName()

Description copied from interface: `Ref`
What this ref is called within the repository.

Specified by:
  `getName` in interface `Ref`
Returns:
  name of this ref.

#### isSymbolic

    public boolean isSymbolic()

Description copied from interface: `Ref`
Test if this reference is a symbolic reference.

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.

Specified by:
  `isSymbolic` in interface `Ref`
Returns:
  true if this is a symbolic reference; false if this reference contains its own ObjectId.

#### getLeaf

    public Ref getLeaf()

Description copied from interface: `Ref`
Traverse target references until `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;

Specified by:
  `getLeaf` in interface `Ref`
Returns:
  the reference that actually stores the ObjectId value.

#### getTarget

    public Ref getTarget()

Description copied from interface: `Ref`
Get the reference this reference points to, or `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`.

Specified by:
  `getTarget` in interface `Ref`
Returns:
  the target reference, or `this`.

#### getObjectId

    public ObjectId getObjectId()

Description copied from interface: `Ref`
Cached value of this ref.

Specified by:
  `getObjectId` in interface `Ref`
Returns:
  the value of this ref at the last time we read it.

#### getStorage

    public Ref.Storage getStorage()

Description copied from interface: `Ref`
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:
  `getStorage` in interface `Ref`
Returns:
  type of ref.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`