Package com.spotify.github.v3.repos
Class ImmutableCommit
- java.lang.Object
-
- com.spotify.github.v3.repos.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 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 Optional<User>
author()
Author userstatic ImmutableCommit.Builder
builder()
Creates a builder forImmutableCommit
.URI
commentsUrl()
Comments URLCommit
commit()
Commit detailsstatic 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.List<File>
files()
File objects included in the commit.int
hashCode()
Computes a hash code from attributes:sha
,url
,commit
,htmlUrl
,commentsUrl
,author
,parents
,stats
,files
.URI
htmlUrl()
HTML URLList<ShaLink>
parents()
The SHAs of the commits that were the parents of this commitString
sha()
SHA.Map<String,Integer>
stats()
Commit statistics key, value map.String
toString()
Prints the immutable valueCommit
with attribute values.URI
url()
URL.ImmutableCommit
withAuthor(User value)
Copy the current immutable object by setting a present value for the optionalauthor
attribute.ImmutableCommit
withAuthor(Optional<? extends User> optional)
Copy the current immutable object by setting an optional value for theauthor
attribute.ImmutableCommit
withCommentsUrl(URI value)
Copy the current immutable object by setting a value for thecommentsUrl
attribute.ImmutableCommit
withCommit(Commit value)
Copy the current immutable object by setting a value for thecommit
attribute.ImmutableCommit
withFiles(File... elements)
Copy the current immutable object with elements that replace the content offiles
.ImmutableCommit
withFiles(Iterable<? extends File> elements)
Copy the current immutable object with elements that replace the content offiles
.ImmutableCommit
withHtmlUrl(URI value)
Copy the current immutable object by setting a value for thehtmlUrl
attribute.ImmutableCommit
withParents(ShaLink... elements)
Copy the current immutable object with elements that replace the content ofparents
.ImmutableCommit
withParents(Iterable<? extends ShaLink> elements)
Copy the current immutable object with elements that replace the content ofparents
.ImmutableCommit
withSha(String value)
Copy the current immutable object by setting a value for thesha
attribute.ImmutableCommit
withStats(Map<String,? extends Integer> entries)
Copy the current immutable object by replacing thestats
map with the specified map.ImmutableCommit
withUrl(URI value)
Copy the current immutable object by setting a value for theurl
attribute.
-
-
-
Method Detail
-
commit
@Nullable public Commit commit()
Commit details- Specified by:
commit
in interfaceCommitItem
-
htmlUrl
@Nullable public URI htmlUrl()
HTML URL- Specified by:
htmlUrl
in interfaceCommitItem
-
commentsUrl
@Nullable public URI commentsUrl()
Comments URL- Specified by:
commentsUrl
in interfaceCommitItem
-
author
public Optional<User> author()
Author user- Specified by:
author
in interfaceCommitItem
-
parents
@Nullable public List<ShaLink> parents()
The SHAs of the commits that were the parents of this commit- Specified by:
parents
in interfaceCommitItem
-
stats
@Nullable public Map<String,Integer> stats()
Commit statistics key, value map. E.g. additions: 104 deletions: 4 total: 108
-
withSha
public final ImmutableCommit withSha(@Nullable String value)
Copy the current immutable object by setting a value for thesha
attribute. An equals check used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for sha (can benull
)- 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 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
-
withCommit
public final ImmutableCommit withCommit(@Nullable Commit value)
Copy the current immutable object by setting a value for thecommit
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for commit (can benull
)- 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 thehtmlUrl
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for htmlUrl (can benull
)- 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 thecommentsUrl
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for commentsUrl (can benull
)- 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 optionalauthor
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 theauthor
attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returningthis
.- 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 ofparents
.- 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 ofparents
. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- 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 thestats
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 returningthis
.- 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 offiles
.- 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 offiles
. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- 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 ofImmutableCommit
that have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:sha
,url
,commit
,htmlUrl
,commentsUrl
,author
,parents
,stats
,files
.
-
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 | null) // nullable
sha
.url(java.net.URI | null) // nullableurl
.commit(com.spotify.github.v3.git.Commit | null) // nullablecommit
.htmlUrl(java.net.URI | null) // nullablehtmlUrl
.commentsUrl(java.net.URI | null) // nullablecommentsUrl
.author(com.spotify.github.v3.User) // optionalauthor
.parents(List<com.spotify.github.v3.git.ShaLink> | null) // nullableparents
.stats(Map<String, Integer> | null) // nullablestats
.files(List<com.spotify.github.v3.repos.File> | null) // nullablefiles
.build();- Returns:
- A new ImmutableCommit builder
-
-