Class ImmutablePushEvent
- java.lang.Object
-
- com.spotify.github.v3.activity.events.ImmutablePushEvent
-
- All Implemented Interfaces:
PushEvent
@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutablePushEvent extends Object implements PushEvent
Immutable implementation ofPushEvent
.Use the builder to create immutable instances:
ImmutablePushEvent.builder()
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ImmutablePushEvent.Builder
Builds instances of typeImmutablePushEvent
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
after()
SHA of the repository state after the push.Optional<String>
baseRef()
Base referenceString
before()
The SHA of the most recent commit on ref before the push.static ImmutablePushEvent.Builder
builder()
Creates a builder forImmutablePushEvent
.List<PushCommit>
commits()
An array of commit objects describing the pushed commits.String
compare()
Compare API URL This is a string because of malformed URIs sent from github.static ImmutablePushEvent
copyOf(PushEvent instance)
Creates an immutable copy of aPushEvent
value.Boolean
created()
True if given reference was createdBoolean
deleted()
True if given reference was deletedboolean
equals(Object another)
This instance is equal to all instances ofImmutablePushEvent
that have equal attribute values.Boolean
forced()
True if given reference was force pushedint
hashCode()
Computes a hash code from attributes:repository
,sender
,ref
,before
,after
,created
,deleted
,forced
,baseRef
,compare
,commits
,headCommit
,pusher
.Optional<PushCommit>
headCommit()
The push commit object of the most recent commit on ref after the push.Author
pusher()
PusherString
ref()
The full Git ref that was pushed.PushRepository
repository()
ThePushRepository
User
sender()
TheUser
that triggered/sent the event.String
toString()
Prints the immutable valuePushEvent
with attribute values.ImmutablePushEvent
withAfter(String value)
Copy the current immutable object by setting a value for theafter
attribute.ImmutablePushEvent
withBaseRef(String value)
Copy the current immutable object by setting a present value for the optionalbaseRef
attribute.ImmutablePushEvent
withBaseRef(Optional<String> optional)
Copy the current immutable object by setting an optional value for thebaseRef
attribute.ImmutablePushEvent
withBefore(String value)
Copy the current immutable object by setting a value for thebefore
attribute.ImmutablePushEvent
withCommits(PushCommit... elements)
Copy the current immutable object with elements that replace the content ofcommits
.ImmutablePushEvent
withCommits(Iterable<? extends PushCommit> elements)
Copy the current immutable object with elements that replace the content ofcommits
.ImmutablePushEvent
withCompare(String value)
Copy the current immutable object by setting a value for thecompare
attribute.ImmutablePushEvent
withCreated(Boolean value)
Copy the current immutable object by setting a value for thecreated
attribute.ImmutablePushEvent
withDeleted(Boolean value)
Copy the current immutable object by setting a value for thedeleted
attribute.ImmutablePushEvent
withForced(Boolean value)
Copy the current immutable object by setting a value for theforced
attribute.ImmutablePushEvent
withHeadCommit(Optional<PushCommit> value)
Copy the current immutable object by setting a value for theheadCommit
attribute.ImmutablePushEvent
withPusher(Author value)
Copy the current immutable object by setting a value for thepusher
attribute.ImmutablePushEvent
withRef(String value)
Copy the current immutable object by setting a value for theref
attribute.ImmutablePushEvent
withRepository(PushRepository value)
Copy the current immutable object by setting a value for therepository
attribute.ImmutablePushEvent
withSender(User value)
Copy the current immutable object by setting a value for thesender
attribute.
-
-
-
Method Detail
-
repository
@Nullable public PushRepository repository()
ThePushRepository
- Specified by:
repository
in interfacePushEvent
-
ref
@Nullable public String ref()
The full Git ref that was pushed. Example: "refs/heads/master".
-
before
@Nullable public String before()
The SHA of the most recent commit on ref before the push.
-
after
@Nullable public String after()
SHA of the repository state after the push.
-
created
@Nullable public Boolean created()
True if given reference was created
-
deleted
@Nullable public Boolean deleted()
True if given reference was deleted
-
forced
@Nullable public Boolean forced()
True if given reference was force pushed
-
compare
@Nullable public String compare()
Compare API URL This is a string because of malformed URIs sent from github. They send unencoded '^' in the uri path.
-
commits
@Nullable public List<PushCommit> commits()
An array of commit objects describing the pushed commits. (The array includes a maximum of 20 commits. If necessary, you can use the Commits API to fetch additional commits. This limit is applied to timeline events only and isn't applied to webhook deliveries.)
-
headCommit
@Nullable public Optional<PushCommit> headCommit()
The push commit object of the most recent commit on ref after the push.- Specified by:
headCommit
in interfacePushEvent
-
withRepository
public final ImmutablePushEvent withRepository(@Nullable PushRepository value)
Copy the current immutable object by setting a value for therepository
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for repository (can benull
)- Returns:
- A modified copy of the
this
object
-
withSender
public final ImmutablePushEvent withSender(@Nullable User value)
Copy the current immutable object by setting a value for thesender
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for sender (can benull
)- Returns:
- A modified copy of the
this
object
-
withRef
public final ImmutablePushEvent withRef(@Nullable String value)
Copy the current immutable object by setting a value for theref
attribute. An equals check used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for ref (can benull
)- Returns:
- A modified copy of the
this
object
-
withBefore
public final ImmutablePushEvent withBefore(@Nullable String value)
Copy the current immutable object by setting a value for thebefore
attribute. An equals check used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for before (can benull
)- Returns:
- A modified copy of the
this
object
-
withAfter
public final ImmutablePushEvent withAfter(@Nullable String value)
Copy the current immutable object by setting a value for theafter
attribute. An equals check used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for after (can benull
)- Returns:
- A modified copy of the
this
object
-
withCreated
public final ImmutablePushEvent withCreated(@Nullable Boolean value)
Copy the current immutable object by setting a value for thecreated
attribute. An equals check used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for created (can benull
)- Returns:
- A modified copy of the
this
object
-
withDeleted
public final ImmutablePushEvent withDeleted(@Nullable Boolean value)
Copy the current immutable object by setting a value for thedeleted
attribute. An equals check used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for deleted (can benull
)- Returns:
- A modified copy of the
this
object
-
withForced
public final ImmutablePushEvent withForced(@Nullable Boolean value)
Copy the current immutable object by setting a value for theforced
attribute. An equals check used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for forced (can benull
)- Returns:
- A modified copy of the
this
object
-
withBaseRef
public final ImmutablePushEvent withBaseRef(String value)
Copy the current immutable object by setting a present value for the optionalbaseRef
attribute.- Parameters:
value
- The value for baseRef- Returns:
- A modified copy of
this
object
-
withBaseRef
public final ImmutablePushEvent withBaseRef(Optional<String> optional)
Copy the current immutable object by setting an optional value for thebaseRef
attribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis
.- Parameters:
optional
- A value for baseRef- Returns:
- A modified copy of
this
object
-
withCompare
public final ImmutablePushEvent withCompare(@Nullable String value)
Copy the current immutable object by setting a value for thecompare
attribute. An equals check used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for compare (can benull
)- Returns:
- A modified copy of the
this
object
-
withCommits
public final ImmutablePushEvent withCommits(@Nullable PushCommit... elements)
Copy the current immutable object with elements that replace the content ofcommits
.- Parameters:
elements
- The elements to set- Returns:
- A modified copy of
this
object
-
withCommits
public final ImmutablePushEvent withCommits(@Nullable Iterable<? extends PushCommit> elements)
Copy the current immutable object with elements that replace the content ofcommits
. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
elements
- An iterable of commits elements to set- Returns:
- A modified copy of
this
object
-
withHeadCommit
public final ImmutablePushEvent withHeadCommit(@Nullable Optional<PushCommit> value)
Copy the current immutable object by setting a value for theheadCommit
attribute. An equals check used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for headCommit (can benull
)- Returns:
- A modified copy of the
this
object
-
withPusher
public final ImmutablePushEvent withPusher(@Nullable Author value)
Copy the current immutable object by setting a value for thepusher
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for pusher (can benull
)- Returns:
- A modified copy of the
this
object
-
equals
public boolean equals(@Nullable Object another)
This instance is equal to all instances ofImmutablePushEvent
that have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:repository
,sender
,ref
,before
,after
,created
,deleted
,forced
,baseRef
,compare
,commits
,headCommit
,pusher
.
-
toString
public String toString()
Prints the immutable valuePushEvent
with attribute values.
-
copyOf
public static ImmutablePushEvent copyOf(PushEvent instance)
Creates an immutable copy of aPushEvent
value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance
- The instance to copy- Returns:
- A copied immutable PushEvent instance
-
builder
public static ImmutablePushEvent.Builder builder()
Creates a builder forImmutablePushEvent
.ImmutablePushEvent.builder() .repository(com.spotify.github.v3.repos.PushRepository | null) // nullable
repository
.sender(com.spotify.github.v3.User | null) // nullablesender
.ref(String | null) // nullableref
.before(String | null) // nullablebefore
.after(String | null) // nullableafter
.created(Boolean | null) // nullablecreated
.deleted(Boolean | null) // nullabledeleted
.forced(Boolean | null) // nullableforced
.baseRef(String) // optionalbaseRef
.compare(String | null) // nullablecompare
.commits(List<com.spotify.github.v3.repos.PushCommit> | null) // nullablecommits
.headCommit(Optional<com.spotify.github.v3.repos.PushCommit> | null) // nullableheadCommit
.pusher(com.spotify.github.v3.git.Author | null) // nullablepusher
.build();- Returns:
- A new ImmutablePushEvent builder
-
-