Package com.spotify.github.v3.repos
Class ImmutableCommit.Builder
- java.lang.Object
-
- com.spotify.github.v3.repos.ImmutableCommit.Builder
-
- Enclosing class:
- ImmutableCommit
@NotThreadSafe public static final class ImmutableCommit.Builder extends Object
Builds instances of typeImmutableCommit
. Initialize attributes and then invoke thebuild()
method to create an immutable instance.Builder
is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImmutableCommit.Builder
addAllFiles(Iterable<? extends File> elements)
Adds elements tofiles
list.ImmutableCommit.Builder
addAllParents(Iterable<? extends ShaLink> elements)
Adds elements toparents
list.ImmutableCommit.Builder
addFiles(File element)
Adds one element tofiles
list.ImmutableCommit.Builder
addFiles(File... elements)
Adds elements tofiles
list.ImmutableCommit.Builder
addParents(ShaLink element)
Adds one element toparents
list.ImmutableCommit.Builder
addParents(ShaLink... elements)
Adds elements toparents
list.ImmutableCommit.Builder
author(User author)
Initializes the optional valueauthor
to author.ImmutableCommit.Builder
author(Optional<? extends User> author)
Initializes the optional valueauthor
to author.ImmutableCommit
build()
Builds a newImmutableCommit
.ImmutableCommit.Builder
commentsUrl(URI commentsUrl)
Initializes the value for thecommentsUrl
attribute.ImmutableCommit.Builder
commit(Commit commit)
Initializes the value for thecommit
attribute.ImmutableCommit.Builder
files(Iterable<? extends File> elements)
Sets or replaces all elements forfiles
list.ImmutableCommit.Builder
from(ShaLink instance)
Fill a builder with attribute values from the providedcom.spotify.github.v3.git.ShaLink
instance.ImmutableCommit.Builder
from(Commit instance)
Fill a builder with attribute values from the providedcom.spotify.github.v3.repos.Commit
instance.ImmutableCommit.Builder
from(CommitItem instance)
Fill a builder with attribute values from the providedcom.spotify.github.v3.repos.CommitItem
instance.ImmutableCommit.Builder
htmlUrl(URI htmlUrl)
Initializes the value for thehtmlUrl
attribute.ImmutableCommit.Builder
parents(Iterable<? extends ShaLink> elements)
Sets or replaces all elements forparents
list.ImmutableCommit.Builder
putAllStats(Map<String,? extends Integer> entries)
Put all mappings from the specified map as entries tostats
map.ImmutableCommit.Builder
putStats(String key, int value)
Put one entry to thestats
map.ImmutableCommit.Builder
putStats(Map.Entry<String,? extends Integer> entry)
Put one entry to thestats
map.ImmutableCommit.Builder
sha(String sha)
Initializes the value for thesha
attribute.ImmutableCommit.Builder
stats(Map<String,? extends Integer> entries)
Sets or replaces all mappings from the specified map as entries for thestats
map.ImmutableCommit.Builder
tree(ShaLink tree)
Initializes the value for thetree
attribute.ImmutableCommit.Builder
url(URI url)
Initializes the value for theurl
attribute.
-
-
-
Method Detail
-
from
@CanIgnoreReturnValue public final ImmutableCommit.Builder from(Commit instance)
Fill a builder with attribute values from the providedcom.spotify.github.v3.repos.Commit
instance.- Parameters:
instance
- The instance from which to copy values- Returns:
this
builder for use in a chained invocation
-
from
@CanIgnoreReturnValue public final ImmutableCommit.Builder from(ShaLink instance)
Fill a builder with attribute values from the providedcom.spotify.github.v3.git.ShaLink
instance.- Parameters:
instance
- The instance from which to copy values- Returns:
this
builder for use in a chained invocation
-
from
@CanIgnoreReturnValue public final ImmutableCommit.Builder from(CommitItem instance)
Fill a builder with attribute values from the providedcom.spotify.github.v3.repos.CommitItem
instance.- Parameters:
instance
- The instance from which to copy values- Returns:
this
builder for use in a chained invocation
-
sha
@CanIgnoreReturnValue public final ImmutableCommit.Builder sha(@Nullable String sha)
Initializes the value for thesha
attribute.- Parameters:
sha
- The value for sha (can benull
)- Returns:
this
builder for use in a chained invocation
-
url
@CanIgnoreReturnValue public final ImmutableCommit.Builder url(@Nullable URI url)
Initializes the value for theurl
attribute.- Parameters:
url
- The value for url (can benull
)- Returns:
this
builder for use in a chained invocation
-
commit
@CanIgnoreReturnValue public final ImmutableCommit.Builder commit(@Nullable Commit commit)
Initializes the value for thecommit
attribute.- Parameters:
commit
- The value for commit (can benull
)- Returns:
this
builder for use in a chained invocation
-
htmlUrl
@CanIgnoreReturnValue public final ImmutableCommit.Builder htmlUrl(@Nullable URI htmlUrl)
Initializes the value for thehtmlUrl
attribute.- Parameters:
htmlUrl
- The value for htmlUrl (can benull
)- Returns:
this
builder for use in a chained invocation
-
commentsUrl
@CanIgnoreReturnValue public final ImmutableCommit.Builder commentsUrl(@Nullable URI commentsUrl)
Initializes the value for thecommentsUrl
attribute.- Parameters:
commentsUrl
- The value for commentsUrl (can benull
)- Returns:
this
builder for use in a chained invocation
-
author
@CanIgnoreReturnValue public final ImmutableCommit.Builder author(User author)
Initializes the optional valueauthor
to author.- Parameters:
author
- The value for author- Returns:
this
builder for chained invocation
-
author
@CanIgnoreReturnValue public final ImmutableCommit.Builder author(Optional<? extends User> author)
Initializes the optional valueauthor
to author.- Parameters:
author
- The value for author- Returns:
this
builder for use in a chained invocation
-
addParents
@CanIgnoreReturnValue public final ImmutableCommit.Builder addParents(ShaLink element)
Adds one element toparents
list.- Parameters:
element
- A parents element- Returns:
this
builder for use in a chained invocation
-
addParents
@CanIgnoreReturnValue public final ImmutableCommit.Builder addParents(ShaLink... elements)
Adds elements toparents
list.- Parameters:
elements
- An array of parents elements- Returns:
this
builder for use in a chained invocation
-
parents
@CanIgnoreReturnValue public final ImmutableCommit.Builder parents(@Nullable Iterable<? extends ShaLink> elements)
Sets or replaces all elements forparents
list.- Parameters:
elements
- An iterable of parents elements- Returns:
this
builder for use in a chained invocation
-
addAllParents
@CanIgnoreReturnValue public final ImmutableCommit.Builder addAllParents(Iterable<? extends ShaLink> elements)
Adds elements toparents
list.- Parameters:
elements
- An iterable of parents elements- Returns:
this
builder for use in a chained invocation
-
putStats
@CanIgnoreReturnValue public final ImmutableCommit.Builder putStats(String key, int value)
Put one entry to thestats
map.- Parameters:
key
- The key in the stats mapvalue
- The associated value in the stats map- Returns:
this
builder for use in a chained invocation
-
putStats
@CanIgnoreReturnValue public final ImmutableCommit.Builder putStats(Map.Entry<String,? extends Integer> entry)
Put one entry to thestats
map. Nulls are not permitted- Parameters:
entry
- The key and value entry- Returns:
this
builder for use in a chained invocation
-
stats
@CanIgnoreReturnValue public final ImmutableCommit.Builder stats(@Nullable Map<String,? extends Integer> entries)
Sets or replaces all mappings from the specified map as entries for thestats
map. Nulls are not permitted as keys or values, but parameter itself can be null- Parameters:
entries
- The entries that will be added to the stats map- Returns:
this
builder for use in a chained invocation
-
putAllStats
@CanIgnoreReturnValue public final ImmutableCommit.Builder putAllStats(Map<String,? extends Integer> entries)
Put all mappings from the specified map as entries tostats
map. Nulls are not permitted- Parameters:
entries
- The entries that will be added to the stats map- Returns:
this
builder for use in a chained invocation
-
addFiles
@CanIgnoreReturnValue public final ImmutableCommit.Builder addFiles(File element)
Adds one element tofiles
list.- Parameters:
element
- A files element- Returns:
this
builder for use in a chained invocation
-
addFiles
@CanIgnoreReturnValue public final ImmutableCommit.Builder addFiles(File... elements)
Adds elements tofiles
list.- Parameters:
elements
- An array of files elements- Returns:
this
builder for use in a chained invocation
-
files
@CanIgnoreReturnValue public final ImmutableCommit.Builder files(@Nullable Iterable<? extends File> elements)
Sets or replaces all elements forfiles
list.- Parameters:
elements
- An iterable of files elements- Returns:
this
builder for use in a chained invocation
-
addAllFiles
@CanIgnoreReturnValue public final ImmutableCommit.Builder addAllFiles(Iterable<? extends File> elements)
Adds elements tofiles
list.- Parameters:
elements
- An iterable of files elements- Returns:
this
builder for use in a chained invocation
-
tree
@CanIgnoreReturnValue public final ImmutableCommit.Builder tree(@Nullable ShaLink tree)
Initializes the value for thetree
attribute.- Parameters:
tree
- The value for tree (can benull
)- Returns:
this
builder for use in a chained invocation
-
build
public ImmutableCommit build()
Builds a newImmutableCommit
.- Returns:
- An immutable instance of Commit
- Throws:
IllegalStateException
- if any required attributes are missing
-
-