Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Kotlin 是否可以从元注释传递值?_Kotlin_Annotations - Fatal编程技术网

Kotlin 是否可以从元注释传递值?

Kotlin 是否可以从元注释传递值?,kotlin,annotations,Kotlin,Annotations,假设我有这样一个注释: @Target(AnnotationTarget.FUNCTION) @Retention(AnnotationRetention.RUNTIME) @EnumSource(value = MyEnum::class, mode = EnumSource.Mode.EXCLUDE) annotation class TestEachValue 是否可以将值从注释类传递给其中一个注释?比如: @Target(AnnotationTarget.FUNCTION) @Rete

假设我有这样一个注释:

@Target(AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.RUNTIME)
@EnumSource(value = MyEnum::class, mode = EnumSource.Mode.EXCLUDE)
annotation class TestEachValue
是否可以将值从注释类传递给其中一个注释?比如:

@Target(AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.RUNTIME)
@EnumSource(value = MyEnum::class, mode = EnumSource.Mode.EXCLUDE, names=excludes_from_below)
annotation class TestEachValue(val excludes: Array<String>)
如果有帮助的话,我愿意将该值封装在注释中。或者也许Kotlin有一些与内联关键字相当的魔力?如果您能就如何做好这件事提出任何建议,我们将不胜感激