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.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
author(Author author)
Initializes the value for theauthor
attribute.ImmutableCommit
build()
Builds a newImmutableCommit
.ImmutableCommit.Builder
commentCount(int commentCount)
Initializes the optional valuecommentCount
to commentCount.ImmutableCommit.Builder
commentCount(Optional<Integer> commentCount)
Initializes the optional valuecommentCount
to commentCount.ImmutableCommit.Builder
committer(Author committer)
Initializes the value for thecommitter
attribute.ImmutableCommit.Builder
from(Commit instance)
Fill a builder with attribute values from the providedCommit
instance.ImmutableCommit.Builder
message(String message)
Initializes the value for themessage
attribute.ImmutableCommit.Builder
sha(String sha)
Initializes the optional valuesha
to sha.ImmutableCommit.Builder
sha(Optional<String> sha)
Initializes the optional valuesha
to sha.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 providedCommit
instance. 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:
this
builder for use in a chained invocation
-
sha
@CanIgnoreReturnValue public final ImmutableCommit.Builder sha(String sha)
Initializes the optional valuesha
to sha.- Parameters:
sha
- The value for sha- Returns:
this
builder for chained invocation
-
sha
@CanIgnoreReturnValue public final ImmutableCommit.Builder sha(Optional<String> sha)
Initializes the optional valuesha
to sha.- Parameters:
sha
- The value for sha- 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
-
author
@CanIgnoreReturnValue public final ImmutableCommit.Builder author(@Nullable Author author)
Initializes the value for theauthor
attribute.- Parameters:
author
- The value for author (can benull
)- Returns:
this
builder for use in a chained invocation
-
committer
@CanIgnoreReturnValue public final ImmutableCommit.Builder committer(@Nullable Author committer)
Initializes the value for thecommitter
attribute.- Parameters:
committer
- The value for committer (can benull
)- Returns:
this
builder for use in a chained invocation
-
message
@CanIgnoreReturnValue public final ImmutableCommit.Builder message(@Nullable String message)
Initializes the value for themessage
attribute.- Parameters:
message
- The value for message (can benull
)- 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
-
commentCount
@CanIgnoreReturnValue public final ImmutableCommit.Builder commentCount(int commentCount)
Initializes the optional valuecommentCount
to commentCount.- Parameters:
commentCount
- The value for commentCount- Returns:
this
builder for chained invocation
-
commentCount
@CanIgnoreReturnValue public final ImmutableCommit.Builder commentCount(Optional<Integer> commentCount)
Initializes the optional valuecommentCount
to commentCount.- Parameters:
commentCount
- The value for commentCount- 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
-
-