The problem in the getPayload method when used in Scala e.g. is when we want to pattern match against a type.
As by definition, getPayload returns a derivate of a GHEventPayload abstract class. This derivates can either be of type Push, IssueComment or PullRequest.
While in order to get the payload of an event we must provide the type of the derivate class such as Push, meaning that we cannot pattern match for the PushEvent type in order to extract the payload of the event.
For example:
override def onNext(e : GHEventInfo) = e.getType match {
case GHEvent.PUSH => PushEvent.handle(e)
case _ => // All cases not supported yet
}
pattern matches against a type, in our case it can be an event of type Push. Once it is matched against this type, we cannot refer to getPayload because we do not know the type of it, hence we are unable to pattern match against it.
The problem in the getPayload method when used in Scala e.g. is when we want to pattern match against a type.
As by definition, getPayload returns a derivate of a GHEventPayload abstract class. This derivates can either be of type Push, IssueComment or PullRequest.
While in order to get the payload of an event we must provide the type of the derivate class such as Push, meaning that we cannot pattern match for the PushEvent type in order to extract the payload of the event.
For example:
pattern matches against a type, in our case it can be an event of type Push. Once it is matched against this type, we cannot refer to getPayload because we do not know the type of it, hence we are unable to pattern match against it.