Class ImmutableCommitItem

  • All Implemented Interfaces:
    ShaLink, CommitItem

    @ParametersAreNonnullByDefault
    @Generated("org.immutables.processor.ProxyProcessor")
    @Immutable
    @CheckReturnValue
    public final class ImmutableCommitItem
    extends Object
    implements CommitItem
    Immutable implementation of CommitItem.

    Use the builder to create immutable instances: ImmutableCommitItem.builder().

    • Method Detail

      • sha

        @Nullable
        public String sha()
        SHA.
        Specified by:
        sha in interface ShaLink
      • url

        @Nullable
        public URI url()
        URL.
        Specified by:
        url in interface ShaLink
      • parents

        @Nullable
        public List<ShaLink> parents()
        The SHAs of the commits that were the parents of this commit
        Specified by:
        parents in interface CommitItem
      • withSha

        public final ImmutableCommitItem withSha​(@Nullable
                                                 String value)
        Copy the current immutable object by setting a value for the sha attribute. An equals check used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for sha (can be null)
        Returns:
        A modified copy of the this object
      • withUrl

        public final ImmutableCommitItem withUrl​(@Nullable
                                                 URI value)
        Copy the current immutable object by setting a value for the url attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for url (can be null)
        Returns:
        A modified copy of the this object
      • withCommit

        public final ImmutableCommitItem withCommit​(@Nullable
                                                    Commit value)
        Copy the current immutable object by setting a value for the commit attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for commit (can be null)
        Returns:
        A modified copy of the this object
      • withHtmlUrl

        public final ImmutableCommitItem withHtmlUrl​(@Nullable
                                                     URI value)
        Copy the current immutable object by setting a value for the htmlUrl attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for htmlUrl (can be null)
        Returns:
        A modified copy of the this object
      • withCommentsUrl

        public final ImmutableCommitItem withCommentsUrl​(@Nullable
                                                         URI value)
        Copy the current immutable object by setting a value for the commentsUrl attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for commentsUrl (can be null)
        Returns:
        A modified copy of the this object
      • withAuthor

        public final ImmutableCommitItem withAuthor​(User value)
        Copy the current immutable object by setting a present value for the optional author attribute.
        Parameters:
        value - The value for author
        Returns:
        A modified copy of this object
      • withAuthor

        public final ImmutableCommitItem withAuthor​(Optional<? extends User> optional)
        Copy the current immutable object by setting an optional value for the author attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
        Parameters:
        optional - A value for author
        Returns:
        A modified copy of this object
      • withParents

        public final ImmutableCommitItem withParents​(@Nullable
                                                     ShaLink... elements)
        Copy the current immutable object with elements that replace the content of parents.
        Parameters:
        elements - The elements to set
        Returns:
        A modified copy of this object
      • withParents

        public final ImmutableCommitItem withParents​(@Nullable
                                                     Iterable<? extends ShaLink> elements)
        Copy the current immutable object with elements that replace the content of parents. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        elements - An iterable of parents elements to set
        Returns:
        A modified copy of this object
      • equals

        public boolean equals​(@Nullable
                              Object another)
        This instance is equal to all instances of ImmutableCommitItem that have equal attribute values.
        Overrides:
        equals in class Object
        Returns:
        true if this is equal to another instance
      • hashCode

        public int hashCode()
        Computes a hash code from attributes: sha, url, commit, htmlUrl, commentsUrl, author, parents.
        Overrides:
        hashCode in class Object
        Returns:
        hashCode value
      • toString

        public String toString()
        Prints the immutable value CommitItem with attribute values.
        Overrides:
        toString in class Object
        Returns:
        A string representation of the value
      • copyOf

        public static ImmutableCommitItem copyOf​(CommitItem instance)
        Creates an immutable copy of a CommitItem value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
        Parameters:
        instance - The instance to copy
        Returns:
        A copied immutable CommitItem instance
      • builder

        public static ImmutableCommitItem.Builder builder()
        Creates a builder for ImmutableCommitItem.
         ImmutableCommitItem.builder()
            .sha(String | null) // nullable sha
            .url(java.net.URI | null) // nullable url
            .commit(com.spotify.github.v3.git.Commit | null) // nullable commit
            .htmlUrl(java.net.URI | null) // nullable htmlUrl
            .commentsUrl(java.net.URI | null) // nullable commentsUrl
            .author(com.spotify.github.v3.User) // optional author
            .parents(List&lt;com.spotify.github.v3.git.ShaLink&gt; | null) // nullable parents
            .build();
         
        Returns:
        A new ImmutableCommitItem builder