saurabha5
10/04/2018, 3:01 PM@Target(AnnotationTarget.VALUE_PARAMETER,
AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.EXPRESSION)
@Retention(AnnotationRetention.RUNTIME)
annotation class TestAnnotation
now in an function call I want to see if a parameter is annotated or not something like this :
fun testMe(myValue: Any) {
// Want to see if "myValue" is annotated with "TestAnnotation" or not in runtime
println(myValue::class.java.annotations.size)
}
the call to testMe is below
testMe(@TestAnnotation "dummy value")
I am not getting the count 0
. Any other way to get the annotations associated with a parameter. I have tried both in Java and Kotlin and both the places its the same 0
.