Class Branch

  • Direct Known Subclasses:
    Branch.Dead

    @ExportedBean
    public class Branch
    extends Object
    A source code branch. Not to be subclassed outside this plugin.
    • Constructor Detail

      • Branch

        public Branch​(String sourceId,
                      jenkins.scm.api.SCMHead head,
                      SCM scm,
                      List<? extends BranchProperty> properties)
        Constructs a branch instance.
        Parameters:
        sourceId - the SCMSource.getId()
        head - the name of the branch.
        scm - the SCM for the branch.
        properties - the properties to initiate the branch with.
    • Method Detail

      • getSourceId

        public String getSourceId()
        Returns the SCMSource.getId() that this branch originates from.
        Returns:
        the SCMSource.getId() that this branch originates from.
      • getName

        public String getName()
        Returns the name of the branch.
        Returns:
        the name of the branch.
      • getEncodedName

        public String getEncodedName()
        Gets a branch name suitable for use in paths.
        Returns:
        getName() with URL-unsafe characters escaped
        Since:
        0.2-beta-7
      • getHead

        @Exported
        public jenkins.scm.api.SCMHead getHead()
        Returns the of the branch
        Returns:
        the of the branch
      • getScm

        @Exported
        public SCM getScm()
        Returns the SCM for the branch.
        Returns:
        the SCM for the branch.
      • hasProperty

        public boolean hasProperty​(Class<? extends BranchProperty> clazz)
        Tests if a property of a specific type is present.
        Parameters:
        clazz - the specific property type
        Returns:
        true if and only if there is a property of the specified type.
      • getProperty

        @CheckForNull
        public <T extends BranchProperty> T getProperty​(Class<T> clazz)
        Gets the specific property, or null if no such property is found.
        Type Parameters:
        T - the type of property.
        Parameters:
        clazz - the type of property.
        Returns:
        the the specific property, or null if no such property is found.
      • getProperties

        @NonNull
        @Exported
        public List<BranchProperty> getProperties()
        Gets all the properties.
        Returns:
        the properties.
      • getActions

        @NonNull
        @Exported
        public List<Action> getActions()
        Gets all the actions.
        Returns:
        all the actions
      • getAction

        @CheckForNull
        public <T extends Action> T getAction​(Class<T> clazz)
        Gets the specific action, or null if no such property is found.
        Type Parameters:
        T - the type of action
        Parameters:
        clazz - the type of action.
        Returns:
        the first action of the requested type or null if no such action is present.
      • isBuildable

        public boolean isBuildable()
        Returns true iff the branch is can be built.
        Returns:
        true iff the branch is can be built.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object