org.eclipse.jgit.api

## Class NameRevCommand

- java.lang.Object
- - org.eclipse.jgit.api.GitCommand<Map<ObjectId,String>>
  - - org.eclipse.jgit.api.NameRevCommand

All Implemented Interfaces:
  Callable<Map<ObjectId,String>>

    public class NameRevCommand
    extends GitCommand<Map<ObjectId,String>>

Command to find human-readable names of revisions.

Since:
  3.0
See Also:
  Git documentation about name-rev

### Field Summary

### Fields inherited from class org.eclipse.jgit.api.GitCommand

`repo`

### Constructor Summary

Constructors
`protected` `NameRevCommand(Repository repo)` Create a new name-rev command.

### Method Summary

All Methods Instance Methods Concrete Methods
`NameRevCommand` `add(Iterable<ObjectId> ids)` Add multiple objects to search for.
`NameRevCommand` `add(ObjectId id)` Add an object to search for.
`NameRevCommand` `addAnnotatedTags()` Add all annotated tags under `refs/tags/` to the set that all results must match.
`NameRevCommand` `addPrefix(String prefix)` Add a ref prefix to the set that results must match.
`NameRevCommand` `addRef(Ref ref)` Add a ref to the set that all results must match.
`Map<ObjectId,String>` `call()` Executes the command

### Methods inherited from class org.eclipse.jgit.api.GitCommand

`checkCallable, getRepository, setCallable`

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

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

### Constructor Detail

#### NameRevCommand

    protected NameRevCommand(Repository repo)

Create a new name-rev command.

Parameters:
  `repo` -

### Method Detail

#### call

    public Map<ObjectId,String> call()
                              throws GitAPIException

Description copied from class: `GitCommand`
Executes the command

Specified by:
  `call` in interface `Callable<Map<ObjectId,String>>`
Specified by:
  `call` in class `GitCommand<Map<ObjectId,String>>`
Returns:
  T a result. Each command has its own return type
Throws:
  `GitAPIException` - or subclass thereof when an error occurs

#### add

    public NameRevCommand add(ObjectId id)
                       throws MissingObjectException,
                              JGitInternalException

Add an object to search for.

Parameters:
  `id` - object ID to add.
Returns:
  `this`
Throws:
  `MissingObjectException` - the object supplied is not available from the object database.
  `JGitInternalException` - a low-level exception of JGit has occurred. The original exception can be retrieved by calling `Throwable.getCause()`.

#### add

    public NameRevCommand add(Iterable<ObjectId> ids)
                       throws MissingObjectException,
                              JGitInternalException

Add multiple objects to search for.

Parameters:
  `ids` - object IDs to add.
Returns:
  `this`
Throws:
  `MissingObjectException` - the object supplied is not available from the object database.
  `JGitInternalException` - a low-level exception of JGit has occurred. The original exception can be retrieved by calling `Throwable.getCause()`.

#### addPrefix

    public NameRevCommand addPrefix(String prefix)

Add a ref prefix to the set that results must match.

If an object matches multiple refs equally well, the first matching ref added with `addRef(Ref)` is preferred, or else the first matching prefix added by `addPrefix(String)`.

Parameters:
  `prefix` - prefix to add; see `RefDatabase.getRefs(String)`
Returns:
  `this`

#### addAnnotatedTags

    public NameRevCommand addAnnotatedTags()

Add all annotated tags under `refs/tags/` to the set that all results must match.

Calls `addRef(Ref)`; see that method for a note on matching priority.

Returns:
  `this`
Throws:
  `JGitInternalException` - a low-level exception of JGit has occurred. The original exception can be retrieved by calling `Throwable.getCause()`.

#### addRef

    public NameRevCommand addRef(Ref ref)

Add a ref to the set that all results must match.

If an object matches multiple refs equally well, the first matching ref added with `addRef(Ref)` is preferred, or else the first matching prefix added by `addPrefix(String)`.

Parameters:
  `ref` - ref to add.
Returns:
  `this`