Package org.eclipse.jgit.lib
Class TagBuilder
java.lang.Object
org.eclipse.jgit.lib.ObjectBuilder
org.eclipse.jgit.lib.TagBuilder
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 a
RevWalk
and obtain a RevTag instance by calling
RevWalk.parseTag(AnyObjectId).-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]build()Format this builder's state as an annotated tag object.Get the object this tag refers to.intGet the type of object this tag refers to.getTag()Get short name of the tag (norefs/tags/prefix).Get creator of this tag.voidsetObjectId(AnyObjectId obj, int objType) Set the object this tag refers to, and its type.voidsetObjectId(RevObject obj) Set the object this tag refers to, and infer its type.voidSet the name of this tag.voidsetTagger(PersonIdent taggerIdent) Set the creator of this tag.byte[]Deprecated.toString()Methods inherited from class org.eclipse.jgit.lib.ObjectBuilder
getAuthor, getEncoding, getGpgSignature, getMessage, setAuthor, setEncoding, setGpgSignature, setMessage, writeEncoding, writeMultiLineHeader
-
Field Details
-
hobject
private static final byte[] hobject -
htype
private static final byte[] htype -
htag
private static final byte[] htag -
htagger
private static final byte[] htagger -
object
-
type
private int type -
tag
-
-
Constructor Details
-
TagBuilder
public TagBuilder()
-
-
Method Details
-
getObjectType
public int getObjectType()Get the type of object this tag refers to.- Returns:
- the type of object this tag refers to.
-
getObjectId
Get the object this tag refers to.- Returns:
- the object this tag refers to.
-
setObjectId
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
Set the object this tag refers to, and infer its type.- Parameters:
obj- the object the tag will refer to.
-
getTag
Get short name of the tag (norefs/tags/prefix).- Returns:
- short name of the tag (no
refs/tags/prefix).
-
setTag
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
Get creator of this tag.- Returns:
- creator of this tag. May be null.
-
setTagger
Set the creator of this tag.- Parameters:
taggerIdent- the creator. May be null.
-
build
Format this builder's state as an annotated tag object.- Specified by:
buildin classObjectBuilder- Returns:
- this object in the canonical annotated tag format, suitable for storage in a repository.
- Throws:
UnsupportedEncodingException- the encoding specified byObjectBuilder.getEncoding()is not supported by this Java runtime.
-
toByteArray
Deprecated.since 5.11; usebuild()insteadFormat this builder's state as an annotated tag object.- Returns:
- this object in the canonical annotated tag format, suitable for
storage in a repository, or
nullif the tag cannot be encoded
-
toString
-
build()instead