package Ġio . pro venance . event stream . stream . decoder Ċ Ċ import Ġio . pro venance . event stream . adapter . json . decoder . Adapter Ċ import Ġio . pro venance . event stream . adapter . json . decoder . Decoder Engine Ċ import Ġio . pro venance . event stream . stream . New Block Result Ċ import Ġio . pro venance . event stream . stream . rpc . response . MessageType Ċ import Ġio . pro venance . event stream . stream . rpc . response . Rpc Response Ċ Ċ class ĠNew Block Decoder ( decoder Engine : ĠDecoder Engine ) Ġ: ĠDecoder ( decoder Engine ) Ġ{ ĊĠĠĠ Ġoverride Ġval Ġpriority : ĠInt Ġ= Ġ 1 0 0 ĊĊĠĠĠ Ġ// ĠWe Ġhave Ġto Ġbuild Ġa Ġre ified , Ġparameter ized Ġtype Ġsuitable Ġto Ġpass Ġto Ġ` mos hi . adapter ` ĊĠĠĠ Ġ// Ġbecause Ġit 's Ġnot Ġpossible Ġto Ġdo Ġsomething Ġlike Ġ` Rpc Response < New Block Result >:: class . java `: ĊĠĠĠ Ġ// ĠSee Ġhttps :// stackoverflow . com / questions / 4 6 1 9 3 3 5 5 / mos hi - generic - type - adapter ĊĠĠĠ Ġprivate Ġval Ġadapter : ĠAdapter < Rpc Response < New Block Result >> Ġ= Ġdecoder Engine . adapter ( ĊĠĠĠĠĠĠĠ Ġdecoder Engine . parameter ized Type ( Rpc Response :: class . java , ĠNew Block Result :: class . java ) ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġoverride Ġfun Ġdecode ( input : ĠString ): ĠMessageType . New Block ? Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġadapter . fromJson ( input )?. let Ġ{ Ġit . result ?. let Ġ{ Ġblock Ġ-> ĠMessageType . New Block ( block ) Ġ} Ġ} ĊĠĠĠ Ġ} Ċ } Ċ