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 classImmutableCommit.BuilderBuilds instances of typeImmutableCommit.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<User>author()Author userstatic ImmutableCommit.Builderbuilder()Creates a builder forImmutableCommit.URIcommentsUrl()Comments URLCommitcommit()Commit detailsstatic ImmutableCommitcopyOf(Commit instance)Creates an immutable copy of aCommitvalue.booleanequals(Object another)This instance is equal to all instances ofImmutableCommitthat have equal attribute values.List<File>files()File objects included in the commit.inthashCode()Computes a hash code from attributes:sha,url,commit,htmlUrl,commentsUrl,author,parents,stats,files,tree.URIhtmlUrl()HTML URLList<ShaLink>parents()The SHAs of the commits that were the parents of this commitStringsha()SHA.Map<String,Integer>stats()Commit statistics key, value map.StringtoString()Prints the immutable valueCommitwith attribute values.ShaLinktree()The SHA of the tree object this commit points to.URIurl()URL.ImmutableCommitwithAuthor(User value)Copy the current immutable object by setting a present value for the optionalauthorattribute.ImmutableCommitwithAuthor(Optional<? extends User> optional)Copy the current immutable object by setting an optional value for theauthorattribute.ImmutableCommitwithCommentsUrl(URI value)Copy the current immutable object by setting a value for thecommentsUrlattribute.ImmutableCommitwithCommit(Commit value)Copy the current immutable object by setting a value for thecommitattribute.ImmutableCommitwithFiles(File... elements)Copy the current immutable object with elements that replace the content offiles.ImmutableCommitwithFiles(Iterable<? extends File> elements)Copy the current immutable object with elements that replace the content offiles.ImmutableCommitwithHtmlUrl(URI value)Copy the current immutable object by setting a value for thehtmlUrlattribute.ImmutableCommitwithParents(ShaLink... elements)Copy the current immutable object with elements that replace the content ofparents.ImmutableCommitwithParents(Iterable<? extends ShaLink> elements)Copy the current immutable object with elements that replace the content ofparents.ImmutableCommitwithSha(String value)Copy the current immutable object by setting a value for theshaattribute.ImmutableCommitwithStats(Map<String,? extends Integer> entries)Copy the current immutable object by replacing thestatsmap with the specified map.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
-
commit
@Nullable public Commit commit()
Commit details- Specified by:
commitin interfaceCommitItem
-
htmlUrl
@Nullable public URI htmlUrl()
HTML URL- Specified by:
htmlUrlin interfaceCommitItem
-
commentsUrl
@Nullable public URI commentsUrl()
Comments URL- Specified by:
commentsUrlin interfaceCommitItem
-
author
public Optional<User> author()
Author user- Specified by:
authorin interfaceCommitItem
-
parents
@Nullable public List<ShaLink> parents()
The SHAs of the commits that were the parents of this commit- Specified by:
parentsin interfaceCommitItem
-
stats
@Nullable public Map<String,Integer> stats()
Commit statistics key, value map. E.g. additions: 104 deletions: 4 total: 108
-
tree
@Nullable public ShaLink tree()
The SHA of the tree object this commit points to.
-
withSha
public final ImmutableCommit withSha(@Nullable String value)
Copy the current immutable object by setting a value for theshaattribute. 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
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
-
withCommit
public final ImmutableCommit withCommit(@Nullable Commit value)
Copy the current immutable object by setting a value for thecommitattribute. 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
thisobject
-
withHtmlUrl
public final ImmutableCommit withHtmlUrl(@Nullable URI value)
Copy the current immutable object by setting a value for thehtmlUrlattribute. 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
thisobject
-
withCommentsUrl
public final ImmutableCommit withCommentsUrl(@Nullable URI value)
Copy the current immutable object by setting a value for thecommentsUrlattribute. 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
thisobject
-
withAuthor
public final ImmutableCommit withAuthor(User value)
Copy the current immutable object by setting a present value for the optionalauthorattribute.- Parameters:
value- The value for author- Returns:
- A modified copy of
thisobject
-
withAuthor
public final ImmutableCommit withAuthor(Optional<? extends User> optional)
Copy the current immutable object by setting an optional value for theauthorattribute. 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
thisobject
-
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
thisobject
-
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
thisobject
-
withStats
public final ImmutableCommit withStats(@Nullable Map<String,? extends Integer> entries)
Copy the current immutable object by replacing thestatsmap 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
thisobject
-
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
thisobject
-
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
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
-
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,commit,htmlUrl,commentsUrl,author,parents,stats,files,tree.
-
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 | null) // nullablesha.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.tree(com.spotify.github.v3.git.ShaLink | null) // nullabletree.build();- Returns:
- A new ImmutableCommit builder
-
-