Class TagBuilder


  • public class TagBuilder
    extends ObjectBuilder
    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 Detail

      • hobject

        private static final byte[] hobject
      • htype

        private static final byte[] htype
      • htag

        private static final byte[] htag
      • htagger

        private static final byte[] htagger
      • type

        private int type
      • tag

        private java.lang.String tag
    • Constructor Detail

      • TagBuilder

        public TagBuilder()
    • Method Detail

      • getObjectType

        public int getObjectType()
        Get the type of object this tag refers to.
        Returns:
        the type of object this tag refers to.
      • getObjectId

        public ObjectId getObjectId()
        Get the object this tag refers to.
        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 of obj. 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()
        Get short name of the tag (no refs/tags/ prefix).
        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 with refs/ as typically a tag is stored under the reference derived from "refs/tags/" + getTag().
      • getTagger

        public PersonIdent getTagger()
        Get creator of this tag.
        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.
      • build

        public byte[] build()
                     throws java.io.UnsupportedEncodingException
        Format this builder's state as an annotated tag object.
        Specified by:
        build in class ObjectBuilder
        Returns:
        this object in the canonical annotated tag format, suitable for storage in a repository.
        Throws:
        java.io.UnsupportedEncodingException - the encoding specified by ObjectBuilder.getEncoding() is not supported by this Java runtime.
      • toByteArray

        @Deprecated
        public byte[] toByteArray()
        Deprecated.
        since 5.11; use build() instead
        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, or null if the tag cannot be encoded
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object