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.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 ImmutablePushEvent.Builder
addAllCommits(Iterable<? extends PushCommit> elements)
Adds elements tocommits
list.ImmutablePushEvent.Builder
addCommits(PushCommit element)
Adds one element tocommits
list.ImmutablePushEvent.Builder
addCommits(PushCommit... elements)
Adds elements tocommits
list.ImmutablePushEvent.Builder
after(String after)
Initializes the value for theafter
attribute.ImmutablePushEvent.Builder
baseRef(String baseRef)
Initializes the optional valuebaseRef
to baseRef.ImmutablePushEvent.Builder
baseRef(Optional<String> baseRef)
Initializes the optional valuebaseRef
to baseRef.ImmutablePushEvent.Builder
before(String before)
Initializes the value for thebefore
attribute.ImmutablePushEvent
build()
Builds a newImmutablePushEvent
.ImmutablePushEvent.Builder
commits(Iterable<? extends PushCommit> elements)
Sets or replaces all elements forcommits
list.ImmutablePushEvent.Builder
compare(String compare)
Initializes the value for thecompare
attribute.ImmutablePushEvent.Builder
created(Boolean created)
Initializes the value for thecreated
attribute.ImmutablePushEvent.Builder
deleted(Boolean deleted)
Initializes the value for thedeleted
attribute.ImmutablePushEvent.Builder
forced(Boolean forced)
Initializes the value for theforced
attribute.ImmutablePushEvent.Builder
from(PushEvent instance)
Fill a builder with attribute values from the providedPushEvent
instance.ImmutablePushEvent.Builder
headCommit(Optional<PushCommit> headCommit)
Initializes the value for theheadCommit
attribute.ImmutablePushEvent.Builder
pusher(Author pusher)
Initializes the value for thepusher
attribute.ImmutablePushEvent.Builder
ref(String ref)
Initializes the value for theref
attribute.ImmutablePushEvent.Builder
repository(PushRepository repository)
Initializes the value for therepository
attribute.ImmutablePushEvent.Builder
sender(User sender)
Initializes the value for thesender
attribute.
-
-
-
Method Detail
-
from
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder from(PushEvent instance)
Fill a builder with attribute values from the providedPushEvent
instance. 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:
this
builder for use in a chained invocation
-
repository
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder repository(@Nullable PushRepository repository)
Initializes the value for therepository
attribute.- Parameters:
repository
- The value for repository (can benull
)- Returns:
this
builder for use in a chained invocation
-
sender
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder sender(@Nullable User sender)
Initializes the value for thesender
attribute.- Parameters:
sender
- The value for sender (can benull
)- Returns:
this
builder for use in a chained invocation
-
ref
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder ref(@Nullable String ref)
Initializes the value for theref
attribute.- Parameters:
ref
- The value for ref (can benull
)- Returns:
this
builder for use in a chained invocation
-
before
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder before(@Nullable String before)
Initializes the value for thebefore
attribute.- Parameters:
before
- The value for before (can benull
)- Returns:
this
builder for use in a chained invocation
-
after
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder after(@Nullable String after)
Initializes the value for theafter
attribute.- Parameters:
after
- The value for after (can benull
)- Returns:
this
builder for use in a chained invocation
-
created
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder created(@Nullable Boolean created)
Initializes the value for thecreated
attribute.- Parameters:
created
- The value for created (can benull
)- Returns:
this
builder for use in a chained invocation
-
deleted
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder deleted(@Nullable Boolean deleted)
Initializes the value for thedeleted
attribute.- Parameters:
deleted
- The value for deleted (can benull
)- Returns:
this
builder for use in a chained invocation
-
forced
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder forced(@Nullable Boolean forced)
Initializes the value for theforced
attribute.- Parameters:
forced
- The value for forced (can benull
)- Returns:
this
builder for use in a chained invocation
-
baseRef
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder baseRef(String baseRef)
Initializes the optional valuebaseRef
to baseRef.- Parameters:
baseRef
- The value for baseRef- Returns:
this
builder for chained invocation
-
baseRef
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder baseRef(Optional<String> baseRef)
Initializes the optional valuebaseRef
to baseRef.- Parameters:
baseRef
- The value for baseRef- Returns:
this
builder for use in a chained invocation
-
compare
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder compare(@Nullable String compare)
Initializes the value for thecompare
attribute.- Parameters:
compare
- The value for compare (can benull
)- Returns:
this
builder for use in a chained invocation
-
addCommits
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder addCommits(PushCommit element)
Adds one element tocommits
list.- Parameters:
element
- A commits element- Returns:
this
builder for use in a chained invocation
-
addCommits
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder addCommits(PushCommit... elements)
Adds elements tocommits
list.- Parameters:
elements
- An array of commits elements- Returns:
this
builder for use in a chained invocation
-
commits
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder commits(@Nullable Iterable<? extends PushCommit> elements)
Sets or replaces all elements forcommits
list.- Parameters:
elements
- An iterable of commits elements- Returns:
this
builder for use in a chained invocation
-
addAllCommits
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder addAllCommits(Iterable<? extends PushCommit> elements)
Adds elements tocommits
list.- Parameters:
elements
- An iterable of commits elements- Returns:
this
builder for use in a chained invocation
-
headCommit
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder headCommit(@Nullable Optional<PushCommit> headCommit)
Initializes the value for theheadCommit
attribute.- Parameters:
headCommit
- The value for headCommit (can benull
)- Returns:
this
builder for use in a chained invocation
-
pusher
@CanIgnoreReturnValue public final ImmutablePushEvent.Builder pusher(@Nullable Author pusher)
Initializes the value for thepusher
attribute.- Parameters:
pusher
- The value for pusher (can benull
)- Returns:
this
builder 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
-
-