package Ġio . h nd rs . slack . broker . receiver Ċ Ċ import Ġcom . fasterxml . jackson . module . kotlin . jackson ObjectMapper Ċ import Ġio . h nd rs . slack . api . contract . jackson . event . Event Ċ import Ġio . h nd rs . slack . api . contract . jackson . event . Slack Event Ċ import Ġio . h nd rs . slack . broker . store . team . Team Ċ import Ġorg . springframework . http . HttpHeaders Ċ Ċ /** Ċ Ġ* ĠEvent Receiver Ġthat Ġshould Ġbe Ġimplemented Ġto Ġreact Ġto Ġincoming Ġevents Ċ Ġ*/ Ċ abstract Ġclass ĠTyped Event Receiver < T Ġ: ĠEvent >( private Ġval ĠeventType : ĠClass < T >) Ġ: ĠEvent Receiver Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġmapper Ġ= Ġj ack son ObjectMapper () ĊĊĠĠĠ Ġfinal Ġoverride Ġfun Ġsupports Event ( slack Event : ĠSlack Event ): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġthis . supports Event ( slack Event , Ġresolve Mapped Object ( slack Event )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfinal Ġoverride Ġfun Ġon Receive Event ( slack Event : ĠSlack Event , Ġheaders : ĠHttp Headers , Ġteam : ĠTeam ) Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . on Receive Event ( slack Event , Ġresolve Mapped Object ( slack Event ), Ġheaders , Ġteam ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠShould Ġreturn Ġtrue Ġif Ġthe Ġreceiver Ġsupports Ġthe Ġincoming Ġevent . ĊĠĠĠĠ Ġ* ĠThis Ġdefault Ġimplementation Ġreturns Ġtrue Ġwhen Ġthe Ġgeneric Ġ[ eventType ] Ġhas Ġthe Ġsame Ġtype ĊĠĠĠĠ Ġ* Ġas Ġthe Ġincoming Ġ[ slack Event ] ĊĠĠĠĠ Ġ* ĊĠĠĠĠ Ġ* Ġ[ slack Event ] Ġis Ġthe Ġoriginal Ġraw Ġevent ĊĠĠĠĠ Ġ* Ġ[ event ] Ġpayload Ġparsed Ġto Ġthe ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġopen Ġfun Ġsupports Event ( slack Event : ĠSlack Event , Ġevent : ĠT ): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġevent . slack TypeString () Ġ== Ġslack Event . type ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠImplementation Ġthat Ġprovides Ġthe Ġoriginal Ġ[ slack Event ] Ġand Ġthe Ġdeserialized Ġ[ event ] ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġabstract Ġfun Ġon Receive Event ( slack Event : ĠSlack Event , Ġevent : ĠT , Ġheaders : ĠHttp Headers , Ġteam : ĠTeam ) ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠWrites Ġ[ Slack Event ] Ġevent Ġpayload Ġas Ġa Ġjson Ġstring Ġto Ġthen Ġmap Ġit Ġto Ġgiven Ġobject ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġprivate Ġfun Ġresolve Mapped Object ( slack Event : ĠSlack Event ): ĠT Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġjson Ġ= Ġmapper . writeValue AsString ( slack Event . event ) ĊĠĠĠĠĠĠĠ Ġreturn Ġmapper . readValue ( json , ĠeventType ) ĊĠĠĠ Ġ} Ċ } Ċ