Class DefaultBranchSpec

  • All Implemented Interfaces:
    BranchSpec

    public class DefaultBranchSpec
    extends Object
    implements BranchSpec
    Default BranchSpec. Monitors only default branch. Does no mapping: real branch name for any logical branch name is the default branch name.
    Author:
    dmitry.neverov
    • Constructor Detail

      • DefaultBranchSpec

        public DefaultBranchSpec()
    • Method Detail

      • apply

        @NotNull
        public RepositoryState apply​(@NotNull
                                     RepositoryState state)
        Description copied from interface: BranchSpec
        Apply this spec to the given repository state
        Specified by:
        apply in interface BranchSpec
        Parameters:
        state - repository state of interest
        Returns:
        repository state containing only branches matched by this spec
      • getVcsBranchName

        @Nullable
        public String getVcsBranchName​(@NotNull
                                       RepositoryState state,
                                       @Nullable
                                       String logicalBranchName)
        Description copied from interface: BranchSpec
        Maps logical branch name to VCS branch name understandable by VCS plugin. Returns null if vcs branch name was not found.
        Specified by:
        getVcsBranchName in interface BranchSpec
        Parameters:
        state - repository state of interest
        logicalBranchName - logical branch name
        Returns:
        see above
      • getVcsBranchNames

        @NotNull
        public Map<String,​String> getVcsBranchNames​(@NotNull
                                                          RepositoryState state,
                                                          @NotNull
                                                          Collection<String> logicalBranchNames)
        Description copied from interface: BranchSpec
        Returns map of logical branch name to corresponding VCS branch name.
        Specified by:
        getVcsBranchNames in interface BranchSpec
        Parameters:
        state - repository state of interest
        logicalBranchNames - logical branch names
        Returns:
        see above
      • getLogicalBranchNames

        @NotNull
        public Set<String> getLogicalBranchNames​(@NotNull
                                                 RepositoryState state)
        Description copied from interface: BranchSpec
        Returns set of logical branch names for given state. This set doesn't include default branch name.
        Specified by:
        getLogicalBranchNames in interface BranchSpec
        Parameters:
        state - repository state of interest
        Returns:
        see above
      • getLogicalBranchName

        @Nullable
        public String getLogicalBranchName​(@NotNull
                                           String vcsBranchName)
        Description copied from interface: BranchSpec
        Returns a logical name for given vcs branch name or null if branch spec doesn't match given vcs branch
        Specified by:
        getLogicalBranchName in interface BranchSpec
        Parameters:
        vcsBranchName - vcs branch name of interest
        Returns:
        see above
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface BranchSpec
        Returns:
        true if this branch spec is empty, i.e. does not include any branch
      • asString

        @NotNull
        public String asString()
        Description copied from interface: BranchSpec
        Returns a string representation of this branch spec. Branch spec can be re-created from string representation using BranchSpecs#parse(String)
        Specified by:
        asString in interface BranchSpec
        Returns:
        see above
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getOption

        @NotNull
        public <T> T getOption​(@NotNull
                               Option<T> option)
        Description copied from interface: BranchSpec
        Returns value of the specified option or its default value if such option is not specified in this spec
        Specified by:
        getOption in interface BranchSpec
        Parameters:
        option - option of interest
        Returns:
        see above