Package com.spotify.github.v3.git
Class ImmutableCommit.Builder
- java.lang.Object
-
- com.spotify.github.v3.git.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.Builderis 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.Builderauthor(Author author)Initializes the value for theauthorattribute.ImmutableCommitbuild()Builds a newImmutableCommit.ImmutableCommit.BuildercommentCount(int commentCount)Initializes the optional valuecommentCountto commentCount.ImmutableCommit.BuildercommentCount(Optional<Integer> commentCount)Initializes the optional valuecommentCountto commentCount.ImmutableCommit.Buildercommitter(Author committer)Initializes the value for thecommitterattribute.ImmutableCommit.Builderfrom(Commit instance)Fill a builder with attribute values from the providedCommitinstance.ImmutableCommit.Buildermessage(String message)Initializes the value for themessageattribute.ImmutableCommit.Buildersha(String sha)Initializes the optional valueshato sha.ImmutableCommit.Buildersha(Optional<String> sha)Initializes the optional valueshato sha.ImmutableCommit.Buildertree(ShaLink tree)Initializes the value for thetreeattribute.ImmutableCommit.Builderurl(URI url)Initializes the value for theurlattribute.
-
-
-
Method Detail
-
from
@CanIgnoreReturnValue public final ImmutableCommit.Builder from(Commit instance)
Fill a builder with attribute values from the providedCommitinstance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
sha
@CanIgnoreReturnValue public final ImmutableCommit.Builder sha(String sha)
Initializes the optional valueshato sha.- Parameters:
sha- The value for sha- Returns:
thisbuilder for chained invocation
-
sha
@CanIgnoreReturnValue public final ImmutableCommit.Builder sha(Optional<String> sha)
Initializes the optional valueshato sha.- Parameters:
sha- The value for sha- Returns:
thisbuilder for use in a chained invocation
-
url
@CanIgnoreReturnValue public final ImmutableCommit.Builder url(@Nullable URI url)
Initializes the value for theurlattribute.- Parameters:
url- The value for url (can benull)- Returns:
thisbuilder for use in a chained invocation
-
author
@CanIgnoreReturnValue public final ImmutableCommit.Builder author(@Nullable Author author)
Initializes the value for theauthorattribute.- Parameters:
author- The value for author (can benull)- Returns:
thisbuilder for use in a chained invocation
-
committer
@CanIgnoreReturnValue public final ImmutableCommit.Builder committer(@Nullable Author committer)
Initializes the value for thecommitterattribute.- Parameters:
committer- The value for committer (can benull)- Returns:
thisbuilder for use in a chained invocation
-
message
@CanIgnoreReturnValue public final ImmutableCommit.Builder message(@Nullable String message)
Initializes the value for themessageattribute.- Parameters:
message- The value for message (can benull)- Returns:
thisbuilder for use in a chained invocation
-
tree
@CanIgnoreReturnValue public final ImmutableCommit.Builder tree(@Nullable ShaLink tree)
Initializes the value for thetreeattribute.- Parameters:
tree- The value for tree (can benull)- Returns:
thisbuilder for use in a chained invocation
-
commentCount
@CanIgnoreReturnValue public final ImmutableCommit.Builder commentCount(int commentCount)
Initializes the optional valuecommentCountto commentCount.- Parameters:
commentCount- The value for commentCount- Returns:
thisbuilder for chained invocation
-
commentCount
@CanIgnoreReturnValue public final ImmutableCommit.Builder commentCount(Optional<Integer> commentCount)
Initializes the optional valuecommentCountto commentCount.- Parameters:
commentCount- The value for commentCount- Returns:
thisbuilder 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
-
-