alex2069
07/03/2018, 7:52 AMalex2069
07/03/2018, 7:53 AMcoder82
07/03/2018, 7:55 AMcoder82
07/03/2018, 7:55 AMxxxifan
07/03/2018, 8:04 AMHexa
07/03/2018, 8:39 AMmuralimohan962
07/03/2018, 9:45 AMLucas Ł
07/03/2018, 9:47 AMmantono
07/03/2018, 11:54 AMCan Orhan
07/03/2018, 11:56 AMmantono
07/03/2018, 12:00 PMwithContext
). I just felt that the interface in both khttp and ktor were nicer to use.Nikky
07/03/2018, 12:11 PMKrs
07/03/2018, 12:11 PMjlleitschuh
07/03/2018, 3:34 PMfun <T> T.validateAndParse(json: String) : Any? where T: FromJsonString<*>, T: JsonSchema {
TODO()
}
val fromJson : FromJsonString<*>? = type.companionObjectInstance as? FromJsonString<*>
if (fromJson is JsonSchema) {
// The compiler can't find `validateAndParse` even though the type should be a union of FromJsonString<*> & JsonSchema
fromJson.validateAndParse(context.call.receiveText())
}
Is there a workaround I can use to call validateAndParse
?Ruckus
07/03/2018, 3:38 PMwhere T: FromJsonString<*>, T: JsonSchema
means T
has to be both FromJsonString<*>
and JsonSchema
.Ruckus
07/03/2018, 3:38 PMSiva
07/03/2018, 3:46 PMfun start(code : String) {
val config = service.getConfig(code)
if( config == null ) {
return
}
// do actual biz logic based on config.
}
functional style
fun start(code : String) {
val eitherConfig = service.getConfig(code)
when(eitherConfig) {
is Either.Left -> return
}
val config = either.b
// do actual biz logic based on config.
}
doubt: i am not sure how to break function when Right condition occurs and return it. or continue function with right flow.VladimirR
07/03/2018, 3:48 PMSiva
07/03/2018, 3:51 PMredrield
07/03/2018, 4:16 PMredrield
07/03/2018, 4:16 PMdata class
can generate, because of some crap with androidredrield
07/03/2018, 4:16 PMredrield
07/03/2018, 4:16 PMhttps://0x0.st/spYT.png▾
karelpeeters
07/03/2018, 5:14 PMequals
you probably also need a custom hashcode
, right?karelpeeters
07/03/2018, 5:16 PMequals
one.karelpeeters
07/03/2018, 5:16 PMredrield
07/03/2018, 6:54 PMredrield
07/03/2018, 6:54 PMredrield
07/03/2018, 6:55 PMtemp_man
07/03/2018, 7:07 PM