Package org.eclipse.jgit.lib
Class TagBuilder
- java.lang.Object
-
- org.eclipse.jgit.lib.TagBuilder
-
public class TagBuilder extends java.lang.Object
Mutable builder to construct an annotated tag recording a project state. Applications should use this object when they need to manually construct a tag and want precise control over its fields. To read a tag object, construct aRevWalk
and obtain aRevTag
instance by callingRevWalk.parseTag(AnyObjectId)
.
-
-
Constructor Summary
Constructors Constructor Description TagBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
build()
Format this builder's state as an annotated tag object.java.lang.String
getMessage()
ObjectId
getObjectId()
int
getObjectType()
java.lang.String
getTag()
PersonIdent
getTagger()
void
setMessage(java.lang.String newMessage)
Set the tag's message.void
setObjectId(AnyObjectId obj, int objType)
Set the object this tag refers to, and its type.void
setObjectId(RevObject obj)
Set the object this tag refers to, and infer its type.void
setTag(java.lang.String shortName)
Set the name of this tag.void
setTagger(PersonIdent taggerIdent)
Set the creator of this tag.byte[]
toByteArray()
Format this builder's state as an annotated tag object.java.lang.String
toString()
-
-
-
Method Detail
-
getObjectType
public int getObjectType()
- Returns:
- the type of object this tag refers to.
-
getObjectId
public ObjectId getObjectId()
- Returns:
- the object this tag refers to.
-
setObjectId
public void setObjectId(AnyObjectId obj, int objType)
Set the object this tag refers to, and its type.- Parameters:
obj
- the object.objType
- the type ofobj
. Must be a valid type code.
-
setObjectId
public void setObjectId(RevObject obj)
Set the object this tag refers to, and infer its type.- Parameters:
obj
- the object the tag will refer to.
-
getTag
public java.lang.String getTag()
- Returns:
- short name of the tag (no
refs/tags/
prefix).
-
setTag
public void setTag(java.lang.String shortName)
Set the name of this tag.- Parameters:
shortName
- new short name of the tag. This short name should not start withrefs/
as typically a tag is stored under the reference derived from"refs/tags/" + getTag()
.
-
getTagger
public PersonIdent getTagger()
- Returns:
- creator of this tag. May be null.
-
setTagger
public void setTagger(PersonIdent taggerIdent)
Set the creator of this tag.- Parameters:
taggerIdent
- the creator. May be null.
-
getMessage
public java.lang.String getMessage()
- Returns:
- the complete commit message.
-
setMessage
public void setMessage(java.lang.String newMessage)
Set the tag's message.- Parameters:
newMessage
- the tag's message.
-
build
public byte[] build()
Format this builder's state as an annotated tag object.- Returns:
- this object in the canonical annotated tag format, suitable for storage in a repository.
-
toByteArray
public byte[] toByteArray()
Format this builder's state as an annotated tag object.- Returns:
- this object in the canonical annotated tag format, suitable for storage in a repository.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-