Class SCMHead

    • Constructor Detail

      • SCMHead

        public SCMHead​(@NonNull
                       String name)
        Constructor.
        Parameters:
        name - the name.
    • Method Detail

      • getName

        @Exported
        @NonNull
        public String getName()
        Returns the name.
        Specified by:
        getName in interface SCMHeadMixin
        Returns:
        the name.
      • getOrigin

        @Exported
        @NonNull
        public SCMHeadOrigin getOrigin()
        Returns the origin of the head.
        • For centralized version control systems such as Subversion, CVS, etc the return value will always be SCMHeadOrigin.DEFAULT.
        • For distributed version control systems such as Git, Mercurial etc the return value may have other values.
        • For centralized distributed version control systems such as GitHub, Bitbucket, etc the return values may be restricted to SCMHeadOrigin.DEFAULT or instances of SCMHeadOrigin.Fork.
        Specified by:
        getOrigin in interface SCMHeadMixin
        Returns:
        the origin of the head or SCMHeadOrigin.DEFAULT if there can only ever be one origin.
      • getPronoun

        @CheckForNull
        public String getPronoun()
        Get the term used in the UI to represent this kind of SCMHead. Must start with a capital letter.
        Returns:
        the term or null to fall back to the calling context's default.
        Since:
        2.0
      • equals

        public final boolean equals​(Object o)
        Indicates whether some other object is "equal to" this one. Two SCMHeadMixin implementations are equal if and only if:

        By way of example, any implementation of ChangeRequestSCMHead will have their equals behave like so:

             public static class MyChangeRequestSCMHead extends SCMHead implements ChangeRequestSCMHead {
                 //...
                 // this method is implemented for you, but if you had to write it this is what you would
                 // have to write
                 public boolean equals(Object o) {
                     if (!super.equals(o)) {
                         return false;
                     }
                     // can only be equal if they are the same class
                     MyChangeRequestSCMHead that = (MyChangeRequestSCMHead)o;
                     // because we implement ChangeRequestSCMHead and ChangeRequestSCMHead has a getId() method
                     String id1 = this.getId();
                     String id2 = that.getId();
                     if (id1 == null ? id2 != null : !id1.equals(id2)) {
                         return false;
                     }
                     // because we implement ChangeRequestSCMHead and ChangeRequestSCMHead has a getTarget() method
                     SCMHead t1 = this.getTarget();
                     SCMHead t2 = that.getTarget();
                     if (t1 == null ? t2 != null : !t1.equals(t2)) {
                         return false;
                     }
                     // we do not implement any other interfaces extending SCMHeadMixin, so we must be equal
                     return true;
                 }
             }
         
        Overrides:
        equals in class Object
        Parameters:
        o - the object to compare with.
        Returns:
        true if and only if the two objects are equal.
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class Object