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 class
ImmutableCommit.Builder
Builds instances of typeImmutableCommit
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Author
author()
Author commit user.static ImmutableCommit.Builder
builder()
Creates a builder forImmutableCommit
.Optional<Integer>
commentCount()
Number of comments.Author
committer()
Committer commit user.static ImmutableCommit
copyOf(Commit instance)
Creates an immutable copy of aCommit
value.boolean
equals(Object another)
This instance is equal to all instances ofImmutableCommit
that have equal attribute values.int
hashCode()
Computes a hash code from attributes:sha
,url
,author
,committer
,message
,tree
,commentCount
.String
message()
Commit message.Optional<String>
sha()
Commit sha value.String
toString()
Prints the immutable valueCommit
with attribute values.ShaLink
tree()
The SHA of the tree object this commit points to.URI
url()
Commit API URL.ImmutableCommit
withAuthor(Author value)
Copy the current immutable object by setting a value for theauthor
attribute.ImmutableCommit
withCommentCount(int value)
Copy the current immutable object by setting a present value for the optionalcommentCount
attribute.ImmutableCommit
withCommentCount(Optional<Integer> optional)
Copy the current immutable object by setting an optional value for thecommentCount
attribute.ImmutableCommit
withCommitter(Author value)
Copy the current immutable object by setting a value for thecommitter
attribute.ImmutableCommit
withMessage(String value)
Copy the current immutable object by setting a value for themessage
attribute.ImmutableCommit
withSha(String value)
Copy the current immutable object by setting a present value for the optionalsha
attribute.ImmutableCommit
withSha(Optional<String> optional)
Copy the current immutable object by setting an optional value for thesha
attribute.ImmutableCommit
withTree(ShaLink value)
Copy the current immutable object by setting a value for thetree
attribute.ImmutableCommit
withUrl(URI value)
Copy the current immutable object by setting a value for theurl
attribute.
-
-
-
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:
commentCount
in interfaceCommit
-
withSha
public final ImmutableCommit withSha(String value)
Copy the current immutable object by setting a present value for the optionalsha
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 thesha
attribute. 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
this
object
-
withUrl
public final ImmutableCommit withUrl(@Nullable URI value)
Copy the current immutable object by setting a value for theurl
attribute. 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
this
object
-
withAuthor
public final ImmutableCommit withAuthor(@Nullable Author value)
Copy the current immutable object by setting a value for theauthor
attribute. 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
this
object
-
withCommitter
public final ImmutableCommit withCommitter(@Nullable Author value)
Copy the current immutable object by setting a value for thecommitter
attribute. 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
this
object
-
withMessage
public final ImmutableCommit withMessage(@Nullable String value)
Copy the current immutable object by setting a value for themessage
attribute. 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
this
object
-
withTree
public final ImmutableCommit withTree(@Nullable ShaLink value)
Copy the current immutable object by setting a value for thetree
attribute. 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
this
object
-
withCommentCount
public final ImmutableCommit withCommentCount(int value)
Copy the current immutable object by setting a present value for the optionalcommentCount
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 thecommentCount
attribute. 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
this
object
-
equals
public boolean equals(@Nullable Object another)
This instance is equal to all instances ofImmutableCommit
that 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 valueCommit
with attribute values.
-
copyOf
public static ImmutableCommit copyOf(Commit instance)
Creates an immutable copy of aCommit
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 forImmutableCommit
.ImmutableCommit.builder() .sha(String) // optional
sha
.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
-
-