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 classImmutablePushEvent.BuilderBuilds instances of typeImmutablePushEvent.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringafter()SHA of the repository state after the push.Optional<String>baseRef()Base referenceStringbefore()The SHA of the most recent commit on ref before the push.static ImmutablePushEvent.Builderbuilder()Creates a builder forImmutablePushEvent.List<PushCommit>commits()An array of commit objects describing the pushed commits.Stringcompare()Compare API URL This is a string because of malformed URIs sent from github.static ImmutablePushEventcopyOf(PushEvent instance)Creates an immutable copy of aPushEventvalue.Booleancreated()True if given reference was createdBooleandeleted()True if given reference was deletedbooleanequals(Object another)This instance is equal to all instances ofImmutablePushEventthat have equal attribute values.Booleanforced()True if given reference was force pushedinthashCode()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.Authorpusher()PusherStringref()The full Git ref that was pushed.PushRepositoryrepository()ThePushRepositoryUsersender()TheUserthat triggered/sent the event.StringtoString()Prints the immutable valuePushEventwith attribute values.ImmutablePushEventwithAfter(String value)Copy the current immutable object by setting a value for theafterattribute.ImmutablePushEventwithBaseRef(String value)Copy the current immutable object by setting a present value for the optionalbaseRefattribute.ImmutablePushEventwithBaseRef(Optional<String> optional)Copy the current immutable object by setting an optional value for thebaseRefattribute.ImmutablePushEventwithBefore(String value)Copy the current immutable object by setting a value for thebeforeattribute.ImmutablePushEventwithCommits(PushCommit... elements)Copy the current immutable object with elements that replace the content ofcommits.ImmutablePushEventwithCommits(Iterable<? extends PushCommit> elements)Copy the current immutable object with elements that replace the content ofcommits.ImmutablePushEventwithCompare(String value)Copy the current immutable object by setting a value for thecompareattribute.ImmutablePushEventwithCreated(Boolean value)Copy the current immutable object by setting a value for thecreatedattribute.ImmutablePushEventwithDeleted(Boolean value)Copy the current immutable object by setting a value for thedeletedattribute.ImmutablePushEventwithForced(Boolean value)Copy the current immutable object by setting a value for theforcedattribute.ImmutablePushEventwithHeadCommit(PushCommit value)Copy the current immutable object by setting a present value for the optionalheadCommitattribute.ImmutablePushEventwithHeadCommit(Optional<? extends PushCommit> optional)Copy the current immutable object by setting an optional value for theheadCommitattribute.ImmutablePushEventwithPusher(Author value)Copy the current immutable object by setting a value for thepusherattribute.ImmutablePushEventwithRef(String value)Copy the current immutable object by setting a value for therefattribute.ImmutablePushEventwithRepository(PushRepository value)Copy the current immutable object by setting a value for therepositoryattribute.ImmutablePushEventwithSender(User value)Copy the current immutable object by setting a value for thesenderattribute.
-
-
-
Method Detail
-
repository
@Nullable public PushRepository repository()
ThePushRepository- Specified by:
repositoryin 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
public Optional<PushCommit> headCommit()
The push commit object of the most recent commit on ref after the push.- Specified by:
headCommitin interfacePushEvent
-
withRepository
public final ImmutablePushEvent withRepository(@Nullable PushRepository value)
Copy the current immutable object by setting a value for therepositoryattribute. 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
thisobject
-
withSender
public final ImmutablePushEvent withSender(@Nullable User value)
Copy the current immutable object by setting a value for thesenderattribute. 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
thisobject
-
withRef
public final ImmutablePushEvent withRef(@Nullable String value)
Copy the current immutable object by setting a value for therefattribute. 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
thisobject
-
withBefore
public final ImmutablePushEvent withBefore(@Nullable String value)
Copy the current immutable object by setting a value for thebeforeattribute. 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
thisobject
-
withAfter
public final ImmutablePushEvent withAfter(@Nullable String value)
Copy the current immutable object by setting a value for theafterattribute. 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
thisobject
-
withCreated
public final ImmutablePushEvent withCreated(@Nullable Boolean value)
Copy the current immutable object by setting a value for thecreatedattribute. 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
thisobject
-
withDeleted
public final ImmutablePushEvent withDeleted(@Nullable Boolean value)
Copy the current immutable object by setting a value for thedeletedattribute. 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
thisobject
-
withForced
public final ImmutablePushEvent withForced(@Nullable Boolean value)
Copy the current immutable object by setting a value for theforcedattribute. 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
thisobject
-
withBaseRef
public final ImmutablePushEvent withBaseRef(String value)
Copy the current immutable object by setting a present value for the optionalbaseRefattribute.- Parameters:
value- The value for baseRef- Returns:
- A modified copy of
thisobject
-
withBaseRef
public final ImmutablePushEvent withBaseRef(Optional<String> optional)
Copy the current immutable object by setting an optional value for thebaseRefattribute. 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
thisobject
-
withCompare
public final ImmutablePushEvent withCompare(@Nullable String value)
Copy the current immutable object by setting a value for thecompareattribute. 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
thisobject
-
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
thisobject
-
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
thisobject
-
withHeadCommit
public final ImmutablePushEvent withHeadCommit(PushCommit value)
Copy the current immutable object by setting a present value for the optionalheadCommitattribute.- Parameters:
value- The value for headCommit- Returns:
- A modified copy of
thisobject
-
withHeadCommit
public final ImmutablePushEvent withHeadCommit(Optional<? extends PushCommit> optional)
Copy the current immutable object by setting an optional value for theheadCommitattribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for headCommit- Returns:
- A modified copy of
thisobject
-
withPusher
public final ImmutablePushEvent withPusher(@Nullable Author value)
Copy the current immutable object by setting a value for thepusherattribute. 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
thisobject
-
equals
public boolean equals(@Nullable Object another)This instance is equal to all instances ofImmutablePushEventthat 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 valuePushEventwith attribute values.
-
copyOf
public static ImmutablePushEvent copyOf(PushEvent instance)
Creates an immutable copy of aPushEventvalue. 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) // nullablerepository.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(com.spotify.github.v3.repos.PushCommit) // optionalheadCommit.pusher(com.spotify.github.v3.git.Author | null) // nullablepusher.build();- Returns:
- A new ImmutablePushEvent builder
-
-