Class ImmutablePushEvent.Builder
- java.lang.Object
-
- com.spotify.github.v3.activity.events.ImmutablePushEvent.Builder
-
- Enclosing class:
- ImmutablePushEvent
@NotThreadSafe public static final class ImmutablePushEvent.Builder extends Object
Builds instances of typeImmutablePushEvent. 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 ImmutablePushEvent.BuilderaddAllCommits(Iterable<? extends PushCommit> elements)Adds elements tocommitslist.ImmutablePushEvent.BuilderaddCommits(PushCommit element)Adds one element tocommitslist.ImmutablePushEvent.BuilderaddCommits(PushCommit... elements)Adds elements tocommitslist.ImmutablePushEvent.Builderafter(String after)Initializes the value for theafterattribute.ImmutablePushEvent.BuilderbaseRef(String baseRef)Initializes the optional valuebaseRefto baseRef.ImmutablePushEvent.BuilderbaseRef(Optional<String> baseRef)Initializes the optional valuebaseRefto baseRef.ImmutablePushEvent.Builderbefore(String before)Initializes the value for thebeforeattribute.ImmutablePushEventbuild()Builds a newImmutablePushEvent.ImmutablePushEvent.Buildercommits(Iterable<? extends PushCommit> elements)Sets or replaces all elements forcommitslist.ImmutablePushEvent.Buildercompare(String compare)Initializes the value for thecompareattribute.ImmutablePushEvent.Buildercreated(Boolean created)Initializes the value for thecreatedattribute.ImmutablePushEvent.Builderdeleted(Boolean deleted)Initializes the value for thedeletedattribute.ImmutablePushEvent.Builderforced(Boolean forced)Initializes the value for theforcedattribute.ImmutablePushEvent.Builderfrom(PushEvent instance)Fill a builder with attribute values from the providedPushEventinstance.ImmutablePushEvent.BuilderheadCommit(PushCommit headCommit)Initializes the optional valueheadCommitto headCommit.ImmutablePushEvent.BuilderheadCommit(Optional<? extends PushCommit> headCommit)Initializes the optional valueheadCommitto headCommit.ImmutablePushEvent.Builderpusher(Author pusher)Initializes the value for thepusherattribute.ImmutablePushEvent.Builderref(String ref)Initializes the value for therefattribute.ImmutablePushEvent.Builderrepository(PushRepository repository)Initializes the value for therepositoryattribute.ImmutablePushEvent.Buildersender(User sender)Initializes the value for thesenderattribute.
-
-
-
Method Detail
-
from
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder from(PushEvent instance)
Fill a builder with attribute values from the providedPushEventinstance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values. Collection elements and entries will be added, not replaced.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
repository
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder repository(@Nullable PushRepository repository)
Initializes the value for therepositoryattribute.- Parameters:
repository- The value for repository (can benull)- Returns:
thisbuilder for use in a chained invocation
-
sender
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder sender(@Nullable User sender)
Initializes the value for thesenderattribute.- Parameters:
sender- The value for sender (can benull)- Returns:
thisbuilder for use in a chained invocation
-
ref
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder ref(@Nullable String ref)
Initializes the value for therefattribute.- Parameters:
ref- The value for ref (can benull)- Returns:
thisbuilder for use in a chained invocation
-
before
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder before(@Nullable String before)
Initializes the value for thebeforeattribute.- Parameters:
before- The value for before (can benull)- Returns:
thisbuilder for use in a chained invocation
-
after
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder after(@Nullable String after)
Initializes the value for theafterattribute.- Parameters:
after- The value for after (can benull)- Returns:
thisbuilder for use in a chained invocation
-
created
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder created(@Nullable Boolean created)
Initializes the value for thecreatedattribute.- Parameters:
created- The value for created (can benull)- Returns:
thisbuilder for use in a chained invocation
-
deleted
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder deleted(@Nullable Boolean deleted)
Initializes the value for thedeletedattribute.- Parameters:
deleted- The value for deleted (can benull)- Returns:
thisbuilder for use in a chained invocation
-
forced
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder forced(@Nullable Boolean forced)
Initializes the value for theforcedattribute.- Parameters:
forced- The value for forced (can benull)- Returns:
thisbuilder for use in a chained invocation
-
baseRef
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder baseRef(String baseRef)
Initializes the optional valuebaseRefto baseRef.- Parameters:
baseRef- The value for baseRef- Returns:
thisbuilder for chained invocation
-
baseRef
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder baseRef(Optional<String> baseRef)
Initializes the optional valuebaseRefto baseRef.- Parameters:
baseRef- The value for baseRef- Returns:
thisbuilder for use in a chained invocation
-
compare
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder compare(@Nullable String compare)
Initializes the value for thecompareattribute.- Parameters:
compare- The value for compare (can benull)- Returns:
thisbuilder for use in a chained invocation
-
addCommits
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder addCommits(PushCommit element)
Adds one element tocommitslist.- Parameters:
element- A commits element- Returns:
thisbuilder for use in a chained invocation
-
addCommits
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder addCommits(PushCommit... elements)
Adds elements tocommitslist.- Parameters:
elements- An array of commits elements- Returns:
thisbuilder for use in a chained invocation
-
commits
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder commits(@Nullable Iterable<? extends PushCommit> elements)
Sets or replaces all elements forcommitslist.- Parameters:
elements- An iterable of commits elements- Returns:
thisbuilder for use in a chained invocation
-
addAllCommits
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder addAllCommits(Iterable<? extends PushCommit> elements)
Adds elements tocommitslist.- Parameters:
elements- An iterable of commits elements- Returns:
thisbuilder for use in a chained invocation
-
headCommit
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder headCommit(PushCommit headCommit)
Initializes the optional valueheadCommitto headCommit.- Parameters:
headCommit- The value for headCommit- Returns:
thisbuilder for chained invocation
-
headCommit
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder headCommit(Optional<? extends PushCommit> headCommit)
Initializes the optional valueheadCommitto headCommit.- Parameters:
headCommit- The value for headCommit- Returns:
thisbuilder for use in a chained invocation
-
pusher
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder pusher(@Nullable Author pusher)
Initializes the value for thepusherattribute.- Parameters:
pusher- The value for pusher (can benull)- Returns:
thisbuilder for use in a chained invocation
-
build
public ImmutablePushEvent build()
Builds a newImmutablePushEvent.- Returns:
- An immutable instance of PushEvent
- Throws:
IllegalStateException- if any required attributes are missing
-
-