Class ImmutableCommit

  • All Implemented Interfaces:
    ShaLink, Commit, CommitItem

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

    Use the builder to create immutable instances: ImmutableCommit.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
      • stats

        @Nullable
        public Map<String,​Integer> stats()
        Commit statistics key, value map. E.g. additions: 104 deletions: 4 total: 108
        Specified by:
        stats in interface Commit
      • files

        @Nullable
        public List<File> files()
        File objects included in the commit.
        Specified by:
        files in interface Commit
      • withSha

        public final ImmutableCommit 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 ImmutableCommit 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 ImmutableCommit 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 ImmutableCommit 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 ImmutableCommit 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 ImmutableCommit 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 ImmutableCommit 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 ImmutableCommit 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 ImmutableCommit 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
      • withStats

        public final ImmutableCommit withStats​(@Nullable
                                               Map<String,​? extends Integer> entries)
        Copy the current immutable object by replacing the stats map with the specified map. Nulls are not permitted as keys or values. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        entries - The entries to be added to the stats map
        Returns:
        A modified copy of this object
      • withFiles

        public final ImmutableCommit withFiles​(@Nullable
                                               File... elements)
        Copy the current immutable object with elements that replace the content of files.
        Parameters:
        elements - The elements to set
        Returns:
        A modified copy of this object
      • withFiles

        public final ImmutableCommit withFiles​(@Nullable
                                               Iterable<? extends File> elements)
        Copy the current immutable object with elements that replace the content of files. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        elements - An iterable of files 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 ImmutableCommit 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, stats, files.
        Overrides:
        hashCode in class Object
        Returns:
        hashCode value
      • toString

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

        public static ImmutableCommit copyOf​(Commit instance)
        Creates an immutable copy of a Commit 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 Commit instance
      • builder

        public static ImmutableCommit.Builder builder()
        Creates a builder for ImmutableCommit.
         ImmutableCommit.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
            .stats(Map&lt;String, Integer&gt; | null) // nullable stats
            .files(List&lt;com.spotify.github.v3.repos.File&gt; | null) // nullable files
            .build();
         
        Returns:
        A new ImmutableCommit builder