Justin
09/29/2019, 9:12 PMannotation class RunCount(val count: Int)
open class Testable
...and...
@RunCount(3)
class TestA: Testable { ... }
With an instance, like:
val testA = TestA()
how can I figure out which annotations it has?
For example, I tried this:
if (testA is RunCount) ...
But that doesn’t work. Any ideas?Dominaezzz
09/29/2019, 9:20 PMRunCount
an interface?Justin
09/29/2019, 9:34 PMDominaezzz
09/29/2019, 9:35 PMJustin
09/29/2019, 9:36 PMDominaezzz
09/29/2019, 9:37 PMinterface RunCount {
val count: Int
}
class RunCountImpl(override val count: Int)
class TestA : Testable, RunCount by RunCountImpl(3) {
}
Justin
09/29/2019, 9:38 PMDominaezzz
09/29/2019, 9:39 PMkotlinx.serialization
but I wouldn't recommend it.Justin
09/29/2019, 9:41 PMDominaezzz
09/29/2019, 9:42 PMJustin
09/29/2019, 9:44 PM