I'm using KotlinPoet for annotation processing, but I've got an issue. I need return function in generated class, but I'm not sure that KotlinPoet can do it? If you have some experience, please help me.
That I can do:
fun test(): String = ...
That I need to do
fun test(): () -> String = ...
与ClassName
或TypeName
相似,可以使用LambdaTypeName
创建不带参数且String
返回类型的函数类型:
val type = LambdaTypeName.get(returnType = String::class.asTypeName())
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.