Francis Mariano
09/15/2022, 7:10 PMGavin Ray
09/16/2022, 9:30 PMString
using Jackson
Currently, these are modeled like this:
data class ColumnName
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
constructor(@JsonValue val value: String) {
init {
require(value.isNotBlank()) { "Column name cannot be blank" }
require(value.all { it.isLetterOrDigit() || it == '_' }) { "Column name must be alphanumeric" }
}
}
Would the best practice using your library be to just replace the require()
with require(parse(value))
?Youssef Shoaib [MOD]
09/16/2022, 11:20 PMLaurent Laborde
09/17/2022, 10:14 AMAlex Styl
09/17/2022, 12:48 PMLaurent Laborde
09/18/2022, 8:01 AMPhilipp Mayer
09/19/2022, 9:08 AMsealed interface SomeResult {
data class A(val s: String): SomeResult
data class B(val i: Int): SomeResult
data class C(val b: Boolean): SomeResult
}
class SomeService {
fun request1(): SomeResult.A = TODO()
fun request2(): SomeResult.B = TODO()
fun request3(): SomeResult.C = TODO()
}
class MyCurrentImpl(val someService: SomeService) {
fun blabla11(): SomeResult.A {
//same setup, just calls request1()
someService.request1()
TODO()
}
fun blabla22(): SomeResult.B {
//same setup, just calls request2()
someService.request2()
TODO()
}
fun blabla33(): SomeResult.C {
//same setup, just calls request3()
someService.request3()
TODO()
}
//TODO:
// Merge all the setup & call into one method.
// Additionally, supply result type from the outside,
// so I don't have 3 when statements.
inline fun <reified T: SomeResult> getPaymentOptions(): T =
when {
//Error: Type parameter 'T' is not an expression
//Error: Required: T Found: SomeResult.B
T is SomeResult.A -> someService.request1()
T is SomeResult.B -> someService.request2()
T is SomeResult.C -> someService.request3()
}
}
}
The important bit (in my imagination) is, that T
always has to be of type SomeResult
, so it’s sealed. Hence I was hoping to somehow iterate over it.. 🤔
Any ideas? Thanks in advance!groostav
09/20/2022, 8:21 PMwaiting for the connection takes a long time so I use a hard-codedfor users of #coroutines, do you guys find junior developers (or any developers) doing this kind of thing for asyncs? Rather than synchronize properly (maybe because that involves bubbling some future up a call stack or converting a future to a channel for more granular synchronization), they simply insert hard-coded wait statements? I'm kinda mortified. I really don't want to have to explaining concurrency to somebody who works for another company. I want to just say "you're an idiot, call the WaitFor method, and dont ever use this strategy again." Now I have to find a way to put that into an email nicely...in my codesleep(5.seconds)
John Aoussou
09/26/2022, 12:17 PMJuliane Lehmann
09/27/2022, 12:50 PMchristophsturm
09/29/2022, 11:32 AMUgai
09/30/2022, 7:48 AMfun main() {
val v1 : Int = 0
class t {
val v1: Int =1
fun f0() : Int {
return v1
}
}
val t0 = t()
println(t0.f0())
}
I got 0. Is this correct?
I suppose it to be 1.nuhkoca
10/01/2022, 12:40 PMval triangle = Path().apply {
moveTo(x = x, y = y - indicatorHalfSizeInPx)
lineTo(x = x - indicatorHalfSizeInPx, y = y + indicatorHalfSizeInPx)
lineTo(x = x + indicatorHalfSizeInPx, y = y + indicatorHalfSizeInPx)
lineTo(x = x, y = y - indicatorHalfSizeInPx)
close()
}
evanchooly
10/04/2022, 3:30 PMelect
10/06/2022, 9:21 AMSam
10/07/2022, 1:18 PMt: T
, why does t::class
return KClass<out T>
and not KClass<T>
?dewildte
10/08/2022, 4:49 PMelect
10/08/2022, 7:16 PMlouiscad
10/10/2022, 3:01 PMmcpiroman
10/13/2022, 5:36 PModay
10/14/2022, 10:43 AMEllen Spertus
10/15/2022, 4:40 AM!!
on assignments, or they would lose points (and their code would potentially throw NPEs).
A few hours later, a fellow professor (not of my course) posted to an internal Team:
Are other people getting anxious questions about details in assignments? "Professor, I put two exclamation points after 'Hello world!', will you take off points for that?"I let him know that, indeed, I would take points off for having two exclamation points in an assignment.
Davide Giuseppe Farella
10/15/2022, 4:19 PMhhariri
10/16/2022, 11:16 AMYoussef Shoaib [MOD]
10/16/2022, 7:07 PMDavide Giuseppe Farella
10/18/2022, 12:18 PMayodele
10/19/2022, 9:35 AMandylamax
10/23/2022, 9:12 PMmattinger
10/24/2022, 9:35 PMsealed interface A {
abstract class AbstractA: A
class B: AbstractA()
class C: AbstractA()
}
fun x(a: A) {
when (a) {
is A.B -> { }
is A.C -> { }
}
}
Has anyone else noticed this before? I get a compile error on the when saying i need to add an implementation for AbstractA, even though it can never be anything but B or C since those are the only concrete implementations.ayodele
10/27/2022, 8:15 AMayodele
10/27/2022, 8:15 AMYoussef Shoaib [MOD]
10/27/2022, 9:46 AMayodele
10/27/2022, 10:11 AMPablichjenkov
10/28/2022, 1:11 AM