org.eclipse.jgit.api
Class TagCommand

java.lang.Object
  extended by org.eclipse.jgit.api.GitCommand<RevTag>
      extended by org.eclipse.jgit.api.TagCommand
All Implemented Interfaces:
Callable<RevTag>

public class TagCommand
extends GitCommand<RevTag>

A class used to execute a Tag command. It has setters for all supported options and arguments of this command and a call() method to finally execute the command.

See Also:
Git documentation about Tag

Field Summary
 
Fields inherited from class org.eclipse.jgit.api.GitCommand
repo
 
Constructor Summary
protected TagCommand(Repository repo)
           
 
Method Summary
 RevTag call()
          Executes the tag command with all the options and parameters collected by the setter methods of this class.
 String getMessage()
           
 String getName()
           
 RevObject getObjectId()
           
 PersonIdent getTagger()
           
 boolean isForceUpdate()
           
 boolean isSigned()
           
 TagCommand setForceUpdate(boolean forceUpdate)
          If set to true the Tag command may replace an existing tag object.
 TagCommand setMessage(String message)
           
 TagCommand setName(String name)
           
 TagCommand setObjectId(RevObject id)
          Sets the object id of the tag.
 TagCommand setSigned(boolean signed)
          If set to true the Tag command creates a signed tag object.
 TagCommand setTagger(PersonIdent tagger)
          Sets the tagger of the tag.
 
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

TagCommand

protected TagCommand(Repository repo)
Parameters:
repo -
Method Detail

call

public RevTag call()
            throws JGitInternalException,
                   ConcurrentRefUpdateException,
                   InvalidTagNameException,
                   NoHeadException
Executes the tag command with all the options and parameters collected by the setter methods of this class. Each instance of this class should only be used for one invocation of the command (means: one call to call())

Returns:
a RevTag object representing the successful tag
Throws:
NoHeadException - when called on a git repo without a HEAD reference
JGitInternalException - a low-level exception of JGit has occurred. The original exception can be retrieved by calling Throwable.getCause(). Expect only IOException's to be wrapped.
ConcurrentRefUpdateException
InvalidTagNameException

setName

public TagCommand setName(String name)
Parameters:
name - the tag name used for the tag
Returns:
this

getName

public String getName()
Returns:
the tag name used for the tag

getMessage

public String getMessage()
Returns:
the tag message used for the tag

setMessage

public TagCommand setMessage(String message)
Parameters:
message - the tag message used for the tag
Returns:
this

isSigned

public boolean isSigned()
Returns:
whether the tag is signed

setSigned

public TagCommand setSigned(boolean signed)
If set to true the Tag command creates a signed tag object. This corresponds to the parameter -s on the command line.

Parameters:
signed -
Returns:
this

setTagger

public TagCommand setTagger(PersonIdent tagger)
Sets the tagger of the tag. If the tagger is null, a PersonIdent will be created from the info in the repository.

Parameters:
tagger -
Returns:
this

getTagger

public PersonIdent getTagger()
Returns:
the tagger of the tag

getObjectId

public RevObject getObjectId()
Returns:
the object id of the tag

setObjectId

public TagCommand setObjectId(RevObject id)
Sets the object id of the tag. If the object id is null, the commit pointed to from HEAD will be used.

Parameters:
id -
Returns:
this

isForceUpdate

public boolean isForceUpdate()
Returns:
is this a force update

setForceUpdate

public TagCommand setForceUpdate(boolean forceUpdate)
If set to true the Tag command may replace an existing tag object. This corresponds to the parameter -f on the command line.

Parameters:
forceUpdate -
Returns:
this


Copyright © 2011. All Rights Reserved.