Package com.spotify.github.v3.git
Class ImmutableCommit
- java.lang.Object
-
- com.spotify.github.v3.git.ImmutableCommit
-
- All Implemented Interfaces:
Commit
@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableCommit extends Object implements Commit
Immutable implementation ofCommit.Use the builder to create immutable instances:
ImmutableCommit.builder().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableCommit.BuilderBuilds instances of typeImmutableCommit.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Authorauthor()Author commit user.static ImmutableCommit.Builderbuilder()Creates a builder forImmutableCommit.Optional<Integer>commentCount()Number of comments.Authorcommitter()Committer commit user.static ImmutableCommitcopyOf(Commit instance)Creates an immutable copy of aCommitvalue.booleanequals(Object another)This instance is equal to all instances ofImmutableCommitthat have equal attribute values.inthashCode()Computes a hash code from attributes:sha,url,author,committer,message,tree,commentCount.Stringmessage()Commit message.Optional<String>sha()Commit sha value.StringtoString()Prints the immutable valueCommitwith attribute values.ShaLinktree()The SHA of the tree object this commit points to.URIurl()Commit API URL.ImmutableCommitwithAuthor(Author value)Copy the current immutable object by setting a value for theauthorattribute.ImmutableCommitwithCommentCount(int value)Copy the current immutable object by setting a present value for the optionalcommentCountattribute.ImmutableCommitwithCommentCount(Optional<Integer> optional)Copy the current immutable object by setting an optional value for thecommentCountattribute.ImmutableCommitwithCommitter(Author value)Copy the current immutable object by setting a value for thecommitterattribute.ImmutableCommitwithMessage(String value)Copy the current immutable object by setting a value for themessageattribute.ImmutableCommitwithSha(String value)Copy the current immutable object by setting a present value for the optionalshaattribute.ImmutableCommitwithSha(Optional<String> optional)Copy the current immutable object by setting an optional value for theshaattribute.ImmutableCommitwithTree(ShaLink value)Copy the current immutable object by setting a value for thetreeattribute.ImmutableCommitwithUrl(URI value)Copy the current immutable object by setting a value for theurlattribute.
-
-
-
Method Detail
-
author
@Nullable public Author author()
Author commit user.
-
committer
@Nullable public Author committer()
Committer commit user.
-
tree
@Nullable public ShaLink tree()
The SHA of the tree object this commit points to.
-
commentCount
public Optional<Integer> commentCount()
Number of comments.- Specified by:
commentCountin interfaceCommit
-
withSha
public final ImmutableCommit withSha(String value)
Copy the current immutable object by setting a present value for the optionalshaattribute.- Parameters:
value- The value for sha- Returns:
- A modified copy of
thisobject
-
withSha
public final ImmutableCommit withSha(Optional<String> optional)
Copy the current immutable object by setting an optional value for theshaattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for sha- Returns:
- A modified copy of
thisobject
-
withUrl
public final ImmutableCommit withUrl(@Nullable URI value)
Copy the current immutable object by setting a value for theurlattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for url (can benull)- Returns:
- A modified copy of the
thisobject
-
withAuthor
public final ImmutableCommit withAuthor(@Nullable Author value)
Copy the current immutable object by setting a value for theauthorattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for author (can benull)- Returns:
- A modified copy of the
thisobject
-
withCommitter
public final ImmutableCommit withCommitter(@Nullable Author value)
Copy the current immutable object by setting a value for thecommitterattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for committer (can benull)- Returns:
- A modified copy of the
thisobject
-
withMessage
public final ImmutableCommit withMessage(@Nullable String value)
Copy the current immutable object by setting a value for themessageattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for message (can benull)- Returns:
- A modified copy of the
thisobject
-
withTree
public final ImmutableCommit withTree(@Nullable ShaLink value)
Copy the current immutable object by setting a value for thetreeattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for tree (can benull)- Returns:
- A modified copy of the
thisobject
-
withCommentCount
public final ImmutableCommit withCommentCount(int value)
Copy the current immutable object by setting a present value for the optionalcommentCountattribute.- Parameters:
value- The value for commentCount- Returns:
- A modified copy of
thisobject
-
withCommentCount
public final ImmutableCommit withCommentCount(Optional<Integer> optional)
Copy the current immutable object by setting an optional value for thecommentCountattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for commentCount- Returns:
- A modified copy of
thisobject
-
equals
public boolean equals(@Nullable Object another)This instance is equal to all instances ofImmutableCommitthat have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:sha,url,author,committer,message,tree,commentCount.
-
toString
public String toString()
Prints the immutable valueCommitwith attribute values.
-
copyOf
public static ImmutableCommit copyOf(Commit instance)
Creates an immutable copy of aCommitvalue. 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 forImmutableCommit.ImmutableCommit.builder() .sha(String) // optionalsha.url(java.net.URI | null) // nullableurl.author(com.spotify.github.v3.git.Author | null) // nullableauthor.committer(com.spotify.github.v3.git.Author | null) // nullablecommitter.message(String | null) // nullablemessage.tree(com.spotify.github.v3.git.ShaLink | null) // nullabletree.commentCount(Integer) // optionalcommentCount.build();- Returns:
- A new ImmutableCommit builder
-
-