Class ImmutableCommit

  • All Implemented Interfaces:
    Commit

    @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

      • url

        @Nullable
        public URI url()
        Commit API URL.
        Specified by:
        url in interface Commit
      • author

        @Nullable
        public Author author()
        Author commit user.
        Specified by:
        author in interface Commit
      • committer

        @Nullable
        public Author committer()
        Committer commit user.
        Specified by:
        committer in interface Commit
      • message

        @Nullable
        public String message()
        Commit message.
        Specified by:
        message in interface Commit
      • tree

        @Nullable
        public ShaLink tree()
        The SHA of the tree object this commit points to.
        Specified by:
        tree in interface Commit
      • withSha

        public final ImmutableCommit withSha​(String value)
        Copy the current immutable object by setting a present value for the optional sha attribute.
        Parameters:
        value - The value for sha
        Returns:
        A modified copy of this object
      • withSha

        public final ImmutableCommit withSha​(Optional<String> optional)
        Copy the current immutable object by setting an optional value for the sha attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
        Parameters:
        optional - A value for sha
        Returns:
        A modified copy of 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
      • withAuthor

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

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

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

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

        public final ImmutableCommit withCommentCount​(int value)
        Copy the current immutable object by setting a present value for the optional commentCount attribute.
        Parameters:
        value - The value for commentCount
        Returns:
        A modified copy of this object
      • withCommentCount

        public final ImmutableCommit withCommentCount​(Optional<Integer> optional)
        Copy the current immutable object by setting an optional value for the commentCount attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
        Parameters:
        optional - A value for commentCount
        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, author, committer, message, tree, commentCount.
        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) // optional sha
            .url(java.net.URI | null) // nullable url
            .author(com.spotify.github.v3.git.Author | null) // nullable author
            .committer(com.spotify.github.v3.git.Author | null) // nullable committer
            .message(String | null) // nullable message
            .tree(com.spotify.github.v3.git.ShaLink | null) // nullable tree
            .commentCount(Integer) // optional commentCount
            .build();
         
        Returns:
        A new ImmutableCommit builder